Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
I have a clonable template with dynamic folders and need to display text that says Coming Soon if the page count in the folder is empty. I ran a dump to get the k_page_folderpagecount variable so that I could set up my if statement and no matter what I have tried, it will not display the Coming Soon text under the empty folder title, it will however display coming soon if I set it to gt '1'. I am not sure where I am going wrong with this:

Code: Select all
<section id="content" class="fullwidth">
            <cms:folders order='desc'>
               <div class="row">
                  <div class="menu-content">
                     <div class="menu-list">
                        <div class="menu-title cute-12-tablet text-center">
                           <h2><cms:show k_folder_title /></h2>
                        </div>
                     </div>
                  </div>
               </div>
               <cms:pages masterpage='locations.php' folder=k_folder_title>
                  <div class="gap-20"></div>
                  <cms:if k_page_folderpagecount='0'>
                     <h2 class="text-center">COMING SOON!</h2>
                     <cms:else />
                     <div class="single-location row">
                        <div class="cute-4-tablet">
                           <h2><cms:show loc_title /></h2>
                           <p class="address"><cms:show loc_street /><br /><cms:show loc_cs /></p>
                           <p><a href="<cms:show loc_dir />" target="_blank">Get Directions</a></p>
                           <div class="gap-20"></div>
                           <p><span><i class="fa fa-phone-square"></i></span> <cms:show loc_phone /></p>
                           <p><span><i class="fa fa-envelope-o"></i></span> <a href="mailto:<cms:show loc_email />"><cms:show loc_email /></a></p>
                        </div>
                        <div class="cute-4-tablet">
                           <p><strong>Manager:</strong> <cms:show loc_manager /></p>
                           <div class="gap-20"></div>
                           <p><cms:show loc_mf /></p>
                           <p><cms:show loc_ss /></p>
                        </div>
                        <div class="cute-4-tablet">
                           <iframe src="<cms:show loc_map />" width="100%" height="265" frameborder="0" style="border:0"></iframe>
                        </div>
                     </div>
                  </cms:if>
               </cms:pages>
            </cms:folders>
         </section>
Code: Select all
<cms:folders>

    <h2><cms:show k_folder_title /></h2>   
   
    <cms:if k_folder_pagecount >
        <cms:pages folder=k_folder_title>
            ... list pages within this folder ...
        </cms:pages>
    <cms:else />
        <h2>COMING SOON!</h2>
    </cms:if>

</cms:folders>

Hope it helps.
Worked perfectly. Thank you KK!
Now there is a weird thing happening. When I add a 4th folder that has empty pages even though I am setting the order to desc it displays it at the top even though it should be at the bottom of the page. Any idea what would be causing this?
The cms:folders tag supports ordering the displayed items by 'name', 'title', 'id', 'count', 'weight' (default is 'name'). Please take a look at the 'name' of the folder - it should be alphabetically getting sorted to top.

I suggest you use the 'weight' for explicitly setting the sort order (you can set the 'weight' of the folders in admin-panel) -
Code: Select all
<cms:folders orderby='weight'>
That was it. Thanks KK
6 posts Page 1 of 1