开发者

Zend_Controller_Router_Route_Hostname with additional variable

I'm having a problem with chaining some routes using another variable at the end. I'm using wild card sub domains. Like this: http://eric.mysite.dev/mypage1 mypage1 is going to be a GET variable. So what I want is http://mysite.dev/donate/now/index/id/eric/pagename/mypage1

I have it working fine without the pagename like this:

$router=$fc->getRouter();
// Host routes
$accountHostRoute = new Zend_Controller_Router_Route_Hostname(':urlname.mysite.dev', array('module' => 'donate', 'controller' => 'now', 'action' => 'index'), array('urlname'=>'(?!www$).*')
        );

        // Account routes
        $router->addRoute('donateWithHostNameLocal', $accountHostRoute->chain(
            new Zend_Controller_Router_Route_Hostname(
                ':urlname.mysite.dev',
                array(
                    'module' => 'donate',
                    'controller' => 'now',
                    'action' => 'index'
                )
            )
        ));

But I also want the page name, so I tried this but it's not working:

    // Account dynamic pages routes
    $router->addRoute('donateWithHostNamePageNameLocal', $accountHostRoute->chain(
        new Zend_Controller_Router_Route_Hostname(
            ':urlname.mysite.dev/:pagename',
            array(
                'module' => 'donate',
                'controller' => 'now',
                'action' => 'index'
            )
        )
    ));

I get an application error of: Message: Resource 'default:mypage1' not found

Stack trace: 0 /Applications/MAMP/bin/php5/lib/php/ZendFramework-1.9.6/library/Zend/Acl.php(751): Zend_Acl->get('default:mypage1') 1 /Applications/MAMP/htdocs/mysite/application/modules/default/plugins/AccessCheck.php(15): Zend_Acl->isAllowed('guest', 'default:mypage1', 'index') 2 /Applications/MAMP/bin/php5/lib/php/ZendFramework-1.9.6/library/Zend/Controller/Plugin/Broker.php(309): Plugin_AccessCheck->preDispatch(Object(Zend_Controller_Request_Http)) 3 /Applications/MAMP/bin/php5/lib/php/ZendFramework-1.9.6/library/Zend/Controller/Front.php(933): Zend_Controller_Plugin_Broker->preDispatch(Object(Zend_Controller_Request_Http)) 4 /Applications/MAMP/bin/php5/lib/php/ZendFramework-1.9.6/library/Zend/Application/Bootstrap/Bootstrap.php(77): Zend_Controller_Front->dispatch() 5 /Applications/MAMP/bin/php5/lib/php/ZendFramework-1.9.6/library/Zend/Application.php(358): Zend_Application_Bootstrap_Bootstrap->run() 6 /Applications/MAMP/htdocs/mysite/public/index.php(34)开发者_StackOverflow中文版: Zend_Application->run() 7 {main}

Request Parameters: array ( 'controller' => 'mypage1', 'action' => 'index', 'module' => 'default', )


I'd suspect your ACL doesn't have this resource defined and you use custom logic to generate the resources.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜