(on Thursday, 18 December 2008, 01:34 PM -0800):
>
> I'm a ZF noob and I'm having trouble with routes, using the config method:
>
> relevant config.ini
> routes.Admin_Reportbuilder_Report.route =
> "admin/reportbuilder/report/:obj_id"
> routes.Admin_Reportbuilder_Report.defaults.module = admin
> routes.Admin_Reportbuilder_Report.defaults.controller = reportbuilder
> routes.Admin_Reportbuilder_Report.defaults.action = report
>
> relevant bootstrap.php
> $router = $front->getRouter();
> $router->addConfig($config, 'routes');
>
> base url is "zapp" (subdir)
>
> Issue:
>
> 1. in URL http://ssr/zapp/admin/reportbuilder/report/1NW9vZEg (this route
> works, as 1NW9VZEg is the :obj_id)
> 2. this: <?php echo $this->url(array('action'=>'copy')); ?>
> 3. outputs: /zapp/admin/reportbuilder/report/1NW9vZEg
> 4. expected (hoped?): /zapp/admin/reportbuilder/copy
The URL you're trying to build is targetting a different route -- in
this case, the "default" route. So, simply add a second parameter to
your url() call:
<?php echo $this->url(array('action'=>'copy'), 'default'); ?>
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论