Reputation: 59
is there a way to get the current route {placeholder} value in symfony?
I have :
/**
* @Route("/ideas/{page}",
* defaults={"page":1},
* requirements={"page":"^\d+$"},
* name="ideas")
*/
public function ideasAction($page) {
.....
return $this->render('idea/idea.html.twig', ["ideas" => $ideas]);
}
And in my twig I want to do something like this :
<a href="{{ path ('ideas',{'page': getCurrent + 1})}}" title="next page" class="btn btn-default"> > </a>
Is it possible?
Upvotes: 0
Views: 451
Reputation: 59
Like Gara said :
With {{ app.request.get('page') + 1 }}
you can get your placeholder
So this works :
{% set page = app.request.get('page') + 1 %}
<a href="{{ path ('ideas',{'page': page })}}" title="next page" class="btn btn-default"> > </a>
Upvotes: 1