Navigation, highlight current page

后端 未结 7 1325
夕颜
夕颜 2020-12-14 09:15

I\'ve got a parent layout and derived from that child sites.

The parent layout has a navigation, each navigation point represents one child site.

How do i hi

相关标签:
7条回答
  • 2020-12-14 10:20

    Here's what I did:

    <a href='{{ path( 'products' ) }}'{% if app.request.attributes.get( '_route' ) starts with 'products' %} class='active'{% endif %}>Products</a>
    <ul>
        <li><a href='{{ path( 'products_product1' ) }}'{% if app.request.attributes.get( '_route' ) == 'products_product1' %} class='active'{% endif %}>Product 1</a></li>
        <li><a href='{{ path( 'products_product2' ) }}'{% if app.request.attributes.get( '_route' ) == 'products_product2' %} class='active'{% endif %}>Product 2</a></li>
    </ul>
    
    0 讨论(0)
提交回复
热议问题