Hey guys,
I've been searching for a way of getting the controller that was called so I 
can highlight the menu.
I looked in the HTTP Foundation class and it seems that there is no way of 
doing it. 
Even searching here I couldn't find anyone that had the same problem.
Well, now i'm doing it the following way (note that I need it to show some 
element in the html and a class in an element)

<ul class="menu">
            <li {% if (app.request.getPathInfo  == '/foo') 
%}class="selected"{% endif %}>
                {% if (app.request.getPathInfo  == '/foo') %}
                <span class="border left"></span>
                {% endif %}
                <a href="{{ url('foo') }}">Foo</a>
                {% if (app.request.getPathInfo  == '/foo') %}
                <span class="border right"></span>
                {% endif %}
            </li>
            <li {% if (app.request.getPathInfo  == '/bar') 
%}class="selected"{% endif %}>
                {% if (app.request.getPathInfo  == '/bar') %}
                <span class="border left"></span>
                {% endif %}
                <a href="{{ url('bar') }}">Bar</a>
                {% if (app.request.getPathInfo  == '/bar') %}
                <span class="border right"></span>
                {% endif %}
            </li>
</ul>

For now it is working since I don't have /foo/abc for example, all the urls 
are /foo and /bar so the test will work.
Also I think that is not a nice way of testing (actually using the url and 
not the controller name)
So is there anyway of getting the controller name on the template?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to