2009年5月29日星期五

Re: [fw-mvc] create custom default route

by the way that line was commented out in previous email by mistake.
it doesn't work when it's not commented.

Yi Tang wrote:
> All,
>
> I've created a custom default route:
>
> <?php
> class My_Controller_Router_Route_Invalid implements
> Zend_Controller_Router_Route_Interface
> {
> public $defaults = array(
> 'module' => 'default',
> 'controller' => 'error',
> 'action' => 'error',
> );
>
> public function match($path)
> {
> return $this->defaults;
> }
>
> public function assemble($data = array())
> {
> return '';
> }
>
> public static function getInstance(Zend_Config $config)
> {
> return new self();
> }
> }
>
>
> And added it as such:
> $router = $front->getRouter();
> //$router->addRoute('default', new
> My_Controller_Router_Route_Invalid());
> $routesConfig = new Zend_Config_Ini('routes.ini');
> $router->addConfig($routesConfig);
>
> But it just doesn't work, it gives a blank page when i go to any url
> after this, any clue what's wrong?
>
> thanks!
>
> Yi
>

没有评论: