Arcadian
Arcadian

Reputation: 4350

twig: How to get request string?

I have a url: http://myserver.com/mypage?vid=1234

I want to output 1234 on to the page. I have tried this but it is not working:

{{ app.request.get('vid') }}

what am I doing wrong or missing?

Upvotes: 1

Views: 4629

Answers (1)

LP154
LP154

Reputation: 1497

You can do this by using the "query" object :

{{ app.request.query.get('vid') }}

But you should get this value in the controller and then pass it to twig.

EDIT : This answer is based on the asumption that you are using Symfony Framework

Upvotes: 3

Related Questions