lundi 19 décembre 2016

Laravel 5.3: How-to mark navigation menu as active, when the request matches the URL (with language)

I want to mark a navigation menu as "active", when the URL matches the request.

This is working fine:

    <div class="sidebar">
            <ul class="sidebar-menu">
                    <li }>
                            <a href="//dashboard">
                                    <i class="fa fa-dashboard"></i> <span></span>
                            </a>
                    </li>

                    <li }>
                            <a href="//settings">
                                    <i class="fa fa-gears"></i> <span></span>
                            </a>
                    </li>
            </ul>
    </div>

Unfortunately, it's only working and marking the navigation menu, when the URL uses the language code "en". But how can I replace the static string "en" with something more dynamic?

I've already tried to solve this problem by using this code, but it doesn't work:

    <li /dashboard') ? 'class=active' : '') }}}>

What's the best way to solve this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire