Hallo,
ik heb een aantal tutorials gevolgt over het opzetten van het zend framework. nu heb ik een simpele portfolio applicatie gebouwd maar ik krijg een error waar ik niet meet uit de voeten kan.
hieronder de error en de betreffende files.
ERROR:
index.php
IndexController.php
ik heb een aantal tutorials gevolgt over het opzetten van het zend framework. nu heb ik een simpele portfolio applicatie gebouwd maar ik krijg een error waar ik niet meet uit de voeten kan.
hieronder de error en de betreffende files.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| ./portfolio ./application ./controllers IndexContreoller.php ./models ./views ./helpers ./filters ./scripts ./index index.phtml ./library ./Zend ./public index.php |
ERROR:
code:
1
| Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in C:\Wampserver\www\portfolio\library\Zend\Controller\Dispatcher\Standard.php:241 Stack trace: #0 C:\Wampserver\www\portfolio\library\Zend\Controller\Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 C:\Wampserver\www\portfolio\public\index.php(35): Zend_Controller_Front->dispatch() #2 {main} thrown in C:\Wampserver\www\portfolio\library\Zend\Controller\Dispatcher\Standard.php on line 241 |
index.php
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| <?php /** * @author Bas van de Lustgraaf * @copyright 2008 */ // full error reporting error_reporting( E_ALL ); set_include_path( 'C:/Wampserver/www/portfolio/library' ); //includes include_once ( 'Zend/Loader.php' ); //load the classes Zend_Loader::loadClass( 'Zend_Controller_Front' ); Zend_Loader::loadClass( 'Zend_Db' ); Zend_Loader::loadClass( 'Zend_Db_Table' ); //configure the database $options = array( 'host' => 'localhost', 'username' => 'root', 'password' => '', 'dbname' => 'portfolio' ); $db = Zend_Db::factory( 'PDO_MYSQL', $options ); Zend_Db_Table::setDefaultAdapter( $db ); //configure the front controller $controller = Zend_Controller_Front::getInstance(); $controller->setControllerDirectory( './application/controllers' ); $controller->setParam( 'noViewRenderer', true ); //run the controller $controller->dispatch(); ?> |
IndexController.php
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
| <?php /** * @author Bas van de Lustgraaf * @copyright 2008 */ class IndexController extends Zend_Controller_Action { public function init() { $this->initView(); //variablen declaren in header,menu en footer $this->view->url = $this->_request->getBaseUrl(); $this->view->stylesPath = $this->view->url . '/public/styles/'; } public function indexAction() { $this->view->paginaTitel = 'Startpagina'; $this->view->titel = 'Welkom op mijn portfolio :]'; $this->render(); } public function infoAction() { $this->view->paginaTitel = 'Informatie'; $this->view->titel = 'Informatie pagina :]'; $this->render(); } public function contactAction() { $this->view->paginaTitel = 'Contact'; $this->view->titel = 'Neem contact met ons op :]'; $this->render(); } } ?> |