Monday 15 July 2013

php - Zend index action parameters -



php - Zend index action parameters -

i want have url example.com/invoice/id/5

create action

function indexaction(){ echo "test"; }

now seek access action url

example.com/invoice/ or example.com/invoice/index

and pass parameters

example.com/invoice/id/5

here i'm error because zend seek render

id.phtml

my question how have url example.com/invoice/id/5 , not utilize example.com/invoice/index/id/5

by default zend route follows: http://www.example.com/controller/action/param_name/param_value/param_name_1/param_name_1_value

for custom url, have define routes in bootstrap.php of zf1.

$frontcontroller = zend_controller_front::getinstance(); $router = $frontcontroller->getrouter();

$router->addroute( 'someidentifier', new zend_controller_router_route( '/invoice/:id', array( 'controller'=>'invoice', 'action'=>'index' ) ) );

if zf2 think have define custom route in module.php, onbootstrap function , attach eventmanager.

php zend-framework zend-route

No comments:

Post a Comment