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

Support archive

Using Select Entries in Template

Tinch 27 Jun 2012 22:40 question, complete

I'm using the Select Entries variable type to power the sub-menu of each section on our website, but I haven't found a way to get the template to work. This is what I have now:

 
<ul class="nav nav-list">
<li class="nav-header">About Section</li>
{exp:channel:entries channel="ffest_pages" entry_id="{lv_menu_about}"}
<li class="active"><a href="{permalink=about}">{title}</a></li>
{/exp:channel:entries}
</ul>


What am I missing? Thanks.

Replies

  1. Low 27 Jun 2012 23:04

    You're using the var as input for a tag, so make sure Early Parsing is enabled.

    Also make sure the separator is the Pipe character.

    Lastly, if you want the entries in the selected order, use the parameter fixed_order="" instead of entry_id="".

  2. Low 27 Jun 2012 23:08

    And dynamic="no" might help, too.

  3. Tinch 27 Jun 2012 23:12

    Ok, it's outputting entries now, but it's outputting every entry in that channel rather then the ones that are selected. Here's how I've got it:

     
    {exp:channel:entries channel="ffest_pages" fixed_order="{lv_menu_about}" dynamic="no"}
    <li><a href="{permalink=about}">{title}</a></li>
    {/exp:channel:entries}


    Early Parsing is enabled and the seperator is set to the Pipe character.

  4. Low 27 Jun 2012 23:20

    If you turn on template debugging, you should be able to see the channel:entries tag with all its parameters filled out. What does that tell you?

  5. Tinch 27 Jun 2012 23:35

    Actually another way that I was doing this was using the Tables variable type, that worked really well. I could just type in a Menu Item Title and then a Menu Item URL for each Menu Item. But I was trying to find a way to match the {cell_2} to the current URL so I could set an active class on the menu. Any thoughts on that direction?

  6. Tinch 27 Jun 2012 23:38

    For example:

     
    {exp:low_variables:pair var="lv_menu_about"}
    {if count == 1}
    <div class="well whiteBg" style="padding: 8px 0;">
    <ul class="nav nav-list">
    <li class="nav-header">About section</li>
    {/if}
    <li {if "{cell_2}" == ""}class="active"{/if}><a href="{cell_2}">{cell_1}</a></li>
    {if count == total_results}
    </ul>
    </div>
    {/if}
    {/exp:low_variables:pair}

  7. Low 28 Jun 2012 06:45

    The Select Entries way should work, too. But the Table type will be slightly more efficient. I'd probably just use a value you can use in a {path=""} variable, like this:

    {exp:low_variables:pair var="lv_menu_about"} 
    <a href="{path="{cell_2}"}" {if segment_1 == cell_2} class="active"{/if}>{cell_1}</a>
    {/exp:low_variables:pair}