We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Looping entries within looping Categories

Development and Programming

TC-uk's avatar
TC-uk
62 posts
13 years ago
TC-uk's avatar TC-uk

Hi, I’d like to display entries grouped in their categories, but also display content if there are no entries (including the empty category name).

At the moment, if I open a exp:channel:entries loop and there are entries present within that cateogry, then {categories}{cateory_name}{/categories} gets displayed. However If there are no entries {categories}{cateory_name}{/categories} outputs nothing. Perhaps this is logical, but I need to display the category name as a placeholder whether there are entries contained within it or not.

Here’s my the relevant section from the template. Actually this is limited to one category at the moment, my intention is to adjust it to loop the entire category group:

<!--toggle box-->
{exp:channel:entries channel="eis" dynamic="off" category="7" limit="1"}

{if no_results}
       <div class="toggle-block">
        <a href="#%22class=%22opener" class="opener opener-wide"><span><strong>{eis-category}{category_name}{category_id}{exp:channel:category_heading}{category_name}{/exp:channel:category_heading}</strong></span></a>

        <div class="slide-box slide-box-wide">
         <div class="np-holder">
<table class="blue-bordered reset-top-border">

 <tbody>

{embed="EIS/.eis-results-header"}
{embed="EIS/.no_results-eis-issues"}
{/if} 
       <div class="toggle-block expanded">

        <a href="#%22class=%22opener" class="opener opener-wide"><span><strong>{categories}{category_name}{/categories}</strong></span></a>

        <div class="slide-box slide-box-wide">
         <div class="np-holder">
         <table class="blue-bordered reset-top-border">
          <tbody>

{embed="EIS/.eis-results-header"}

{embed="EIS/.eis-results" eis-category="{categories}{category_id}{/categories}"}

{/exp:channel:entries}
          </tbody>
         </table>


         </div>
        </div>
       </div>

Can I achieve this out of the box, or do I need something like NSM Categories?

Thanks in advance, Tony

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.