All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

using low variables for navigation

therooster 4 Mar 2014 07:03 question, complete

so, i got rid of embeds in favor of low variables. i'm using this in all my templat code now:

{exp:low_variables:parse var="my_location:XXX"}
{lv_site_header}
{lv_nav }
{/exp:low_variables:parse}

where XXX is either home, services, contact_us, etc.,

So, I want to show the active state in my nav, based on the page the user is on.

in my lv_nav code I have:

<li {if var=='my_location:home'}class="active"{/if}> <a href="{path=site/index}">Home</a></li>

But no cigar...

Can u help.

Thanks!!

Replies

  1. Low 4 Mar 2014 07:43

    I think you're using the Parse tag in the wrong way. I presume the lv_site_header and lv_nav vars are Textarea variables with Early Parsing enabled.

    You're looking for the preparse: parameter in the Textarea variable type, which is similar to embed variables. So try something like this:

    {lv_site_header} 
    {exp:low_variables:single var="lv_nav" preparse:my_location="home"}


    With the following code in lv_nav:

    <li{if my_location == 'home'} class="active"{/if}>


    Note that if you're using the Tag syntax for the lv_nav variable, you can disable early parsing, as that's irrelevant for the Tag syntax.

  2. therooster 4 Mar 2014 21:58

    Thanks Low!!