php - How do I define multiple routes for one request in Silex? -


is there way in silex define multiple routes 1 request. need able define 2 routes 1 page (both routes takes same page). here's current controller:

$app->get('/digital-agency', function() use ($app) {     return $app['twig']->render('digital_agency.html', $data); }); 

it works when duplicate function this:

$app->get('/digital-agency', function() use ($app) {     return $app['twig']->render('digital_agency.html', $data); });  $app->get('/agencia-digital', function() use ($app) {     return $app['twig']->render('digital_agency.html', $data); }); 

so, idea of more clean way it?

you can save closure variable , pass both routes:

$digital_agency = function() use ($app) {     return $app['twig']->render('digital_agency.html', $data); };  $app->get('/digital-agency', $digital_agency); $app->get('/agencia-digital', $digital_agency); 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -