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

python - No exponential form of the z-axis in matplotlib-3D-plots -

excel vba - VBA Proxy auto-configuration for http requests -

sql server 2008 - split ssrs expression between 2 words -