View Single Post
  #1 (permalink)  
Old 06-10-2008, 01:53 PM
bluesapphire bluesapphire is offline
Junior Member
 
Join Date: Sep 2007
Posts: 3
Question Unable to use/inject custom routers

Hi!
I am adding routers to my index.php [bootstrap file] as follows:

PHP Code:
Zend_Loader::loadClass('Zend_Controller_Router_Rewrite');


$router = new Zend_Controller_Router_Rewrite();


$router->addRoute(
    
'Person',
    new 
Zend_Controller_Router_Route('Person', array('controller' => 'Person''action' => 'index'))
);


$router->setRouter($router);


/* SECOND METHOD OF ADDING ROUTER */


$route = new Zend_Controller_Router_Route(
    
'Person',
    array(
        
'controller' => 'Person',
        
'action'     => 'indexAction'
    
)
);

$router->addRoute('user'$route); 

My Router Controller file name is 'PersonController'. Its code is as follows:

PHP Code:
class PersonController extends Zend_Controller_Action{    
    
    var 
$layout;
    
    
    public function 
indexAction()
    {    
        
$this->_helper->viewRenderer->setNoRender(false);
            
        echo 
'This Is PersonController Class';    
        
    } 
When I want to access http://localhost/personal/dev/Person

Then it gives me error. On the other hand following url works fine.
http://localhost/personal/dev/

Note: I have studied manual/api of ZF visited some links on web, so that I am able to add routers as mentioned above


Can some one guides me that where I am going wrong.



Thanks in advance
Reply With Quote