symfony - How to check app.request.attributes.get('_route')==blog/slug variables -


for eg if url is
http://localhost/project/blog can check current url routes

 {% if app.request.attributes.get('_route') == 'blog' %} </p>this default page</p>     {%endif%} 

but below url:
http://localhost/project/blog/2
not working

{% if app.request.attributes.get('_route') == 'blog/2' %} </p>this blog page 2</p> {%endif%} 

try app.request.requesturi: should return "project/blog/2"

{% if 'blog/2' in app.request.uri  %}     </p>this blog page 2</p> {% endif %} 

Comments

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

php - Using str_replace to translate a MySQL Table in html -

asp.net mvc - Cannot display error message on Editor or EditorFor -