Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-14-2008, 12:29 PM
Junior Member
 
Join Date: Jun 2008
Posts: 1
Unhappy Simple example of book: problem with dispatch()

Hi

I have got some code from the book Apress - Practical Web 2.0 Applications with PHP (Code from Chapter 2 is here) but it doesn't work like it should. Does anyone know why

I have an index.php which loads the Zend library and I added one controller.

In the book they added the command $controller->dispatch(); at the end of index.php - but when I run the code with this command I get an 'invalid controller specified (error)'.... \Standard.php on line 249.

In the source code they don't have this $controller->dispatch(); and the code works well.

Is it correct to leave this dispatch() out of the code?

Thank you

Directories:
Code:
/htdocs
/include
    /Controllers
    /Zend (Zend Library is here)
index.php:
PHP Code:
<?php
    
require_once('Zend/Loader.php');
    
Zend_Loader::registerAutoload();

    
// handle the user request
    
$controller Zend_Controller_Front::getInstance();
    
$controller->setControllerDirectory('../include/Controllers');
    
    
// ---- here is my problem - dispatch does not work
    // $controller->dispatch();
?>
.htaccess:
Code:
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
IndexController.php in /include/Controllers :
PHP Code:
<?php
    
class IndexController extends CustomControllerAction {

        public function 
indexAction() {
        }
    }
?>
CustomControllerAction.php in /include :
PHP Code:
<?php
    
class CustomControllerAction extends Zend_Controller_Action {

        function 
init() {

        }
    }
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-17-2008, 12:31 PM
Junior Member
 
Join Date: Jun 2008
Posts: 4
Default

i think ,
it cant find the errorController.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:23 AM.