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 hide <ul> tag in channel entries list if there are no results

December 17, 2012 1:40pm

Subscribe [2]
  • #1 / Dec 17, 2012 1:40pm

    jsuissa

    147 posts

    Trying to figure out a good way to to hide <ul> tag in channel entries list if there are no results.

    If I move the entries tag above <ul> then that would loop when results do appear.

    Thanks in advance for any suggestions.

    <ul>
     {exp:channel:entries channel="{embed:channel}"  dynamic="off" orderby="date" sort="asc" category="{embed:category}"}
     <li><a href="http://{url_title_path={segment_1}}">{title}</a></li>
     {/exp:channel:entries}
    </ul>
  • #2 / Dec 17, 2012 1:48pm

    MadWebDesigns

    147 posts

    Try something like this:

    {exp:channel:entries channel="{embed:channel}"  dynamic="off" orderby="date" sort="asc" category="{embed:category}"}
    {if count == 1}
    <ul>
    {/if}
     <li><a href="http://{url_title_path={segment_1}}">{title}</a></li>
    {if count== total_results}
    </ul>
    {/if}
     {/exp:channel:entries}

    I hope that helps.

    Cheers,

    Mike

  • #3 / Dec 17, 2012 2:08pm

    jsuissa

    147 posts

    Thank you! That makes perfect sense.

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

ExpressionEngine News!

#eecms, #events, #releases