ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to make an active link in embed menu?

May 02, 2011 8:17am

Subscribe [1]
  • #1 / May 02, 2011 8:17am

    Bernar

    5 posts

    Hi,

    I have a menu that I would like to embed in all the pages, but I don’t know how to make a link active. Here is a part of the code for the list of my menu:

    <ul class="menuholder">  
        [...]
        <li class="menu_productos"><a href="#%22class=%22active" title="Nuestros Productos" class="active">Productos</a></li> 
        <li class="menu_cuidados"><a href="#" title="Cuidados del Cuidador">Cuidados del Cuidador</a></li> 
        [...]
    </ul>

    As you can see, the option of the menu “menu_productos” is active using the class “active”. This changes for the different pages. Is there any way to make an embed menu that includes that information for the different pages?

  • #2 / May 02, 2011 9:04am

    Bernar

    5 posts

    I’ve already found the solution in this same forum :shut:

    First I create the code for the menu page that I want to embed and I include the following code inside the <a> tag for the different lists of my menu:

    {if '{embed:my_location}'=="inicio"} class="active"{/if} href="#"


    Then I embed the menu in the desired page specifying the location

    {embed="embed/menu" my_location="quienes_somos"}

    Sorry for the unnecessary thread

  • #3 / May 02, 2011 8:31pm

    Kevin Smith

    4784 posts

    Hey Bernar, no worries! It’s not unnecessary at all. This thread will no doubt help a number of people who find it in the future.

    Thanks for posting back with your solution, and don’t hesitate to post again in the future!

    Kevin

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases