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.

Show category conditionally

June 26, 2008 5:58am

Subscribe [1]
  • #1 / Jun 26, 2008 5:58am

    Rutger

    25 posts

    Hi all,

    Given the code below, i want the category name not to appear when there are no entries in the category to show. Any ideas would be appreciated.

    {exp:weblog:categories weblog="menu_diner" category_group="2" style="linear"}
    <h2>{category_name}</h2>
    <p><span class="categorydesc">{if category_description}{category_description}{/if}</span><br />
    <a name="{category_name}"></a></p>
    
    <p>{exp:weblog:entries orderby="date" category="{category_id}" weblog="menu_diner" disable="member_data|trackbacks"}<br />
    <div class="menuitem"><br />
    <div class="menudesc">{gerecht}</div><div class="menuprice">€ {prijs}</div><br />
    </div></p>
    
    <p>{/exp:weblog:entries}</p>
    
    <p>{/exp:weblog:categories}

    Thanks in advance for any help!

  • #2 / Jun 26, 2008 10:02am

    Robin Sowell

    13255 posts

    Try the show_empty=“no” parameter in the category tag.  That do the trick?

  • #3 / Jun 26, 2008 10:10am

    Rutger

    25 posts

    Ah, i completely overlooked that parameter, thanks! That did the trick indeed.

  • #4 / Jun 26, 2008 10:16am

    Robin Sowell

    13255 posts

    Yep- lot of options to keep up with!  Glad it was an easy fix- and closing this one out….

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

ExpressionEngine News!

#eecms, #events, #releases