Forum for discussing general topics related to Couch.
15 posts Page 2 of 2
atisz wrote: Sounds great, but unfortunately, it's not working for me. Do I do something wrong? Here is my code:
Code: Select all
<cms:if k_is_folder>
<cms:folders childof=k_folder_name orderby='weight' order='asc' depth='1' >
....
</cms:folders>
</cms:if>

Will this conditional work for the last folder? 'childof' lists deeper folders, so what if there is nothing there?
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
trendoman wrote: KK, aren't they for pages? I thought only number of pages is listed through these system variables. With those, it should be as easy as taking a candy from a child. :lol:

Ok, my bad, i meant those variables:

k_folder_pagecount (Number of pages in the folder)
k_folder_totalpagecount (Total number of pages, including pages in subfolders)

So with those you mentioned job should be done as a piece of cake.

PS I bet I checked available vars with <cms:dump_all />. Seems to be too stressed lately. Now, when i focused specifically on that - k_folder_immediate_children materialized right away. :mrgreen:
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
trendoman wrote: Will this conditional work for the last folder? 'childof' lists deeper folders, so what if there is nothing there?


There aren't folders, but certainly there are some pages. And those pages I have to display somehow. :(
atisz wrote:
trendoman wrote: Will this conditional work for the last folder? 'childof' lists deeper folders, so what if there is nothing there?


There aren't folders, but certainly there are some pages. And those pages I have to display somehow. :(

Code: Select all
<cms:folders>
  <cms:if k_folder_immediate_children='0' >
        <cms:pages folder=k_folder_name >
            ... here come your pages...
            <cms:dump />
        </cms:pages>
  </cms:if>
</cms:folders>
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Hi guys!

As I'm not very familiar with folders - I used theme just on a basic level - I wasn't able to put things together and achieve the desired output. KK was so kind to help me out with this (thank you KK, once again!), so bellow is an image showing the desired result and the KK provided solution, as it might be helpful for others, too.
Code: Select all
<div id="content-container"><!-- Start content-container -->
   <div id="breadcrumbs">
      <cms:if k_is_page || k_is_folder >
          <p><a href="<cms:show k_site_link />">Prima pagina</a> / <cms:breadcrumbs separator='&nbsp;/&nbsp;' include_template='1'/></p>
      </cms:if>
   </div>
         
    <cms:if k_is_folder><!-- we are in a folder view.. check if this folder has any child folders? -->
       <cms:if k_folder_immediate_children  ><!-- if it has child folders, list them -->
           <div id="related-products-container" style="background-image:none;"><!-- Start related-products-container -->               <div id="related-product-gallery"><!-- Start product gallery -->                       
                  <ul>                           
                       <cms:folders childof=k_folder_name orderby='weight' order='asc' depth='1' >                           <li style="margin-bottom:50px;">
                              <a href="<cms:show k_folder_link/>"><img src="<cms:show k_folder_image />" alt="<cms:show k_folder_title/>" title="<cms:show k_folder_title/>" border="0" /><div><i class="fa fa-link"></i></div></a>
                                <h2><a href="<cms:show k_folder_link/>"><cms:show k_folder_title/></a></h2>
                            </li>
                        </cms:folders>
                    </ul>
                </div><!-- End product gallery -->
            </div><!-- End related-products-container -->
        <cms:else /><!-- if however the folder being viewed does not have any child folders (i.e. it is the last in folder hierarchy) then list the pages within this folder -->
           <div id="related-products-container" style="background-image:none;"><!-- Start related-products-container -->               <div id="related-product-gallery"><!-- Start product gallery -->
                  <ul>
                       <cms:pages folder=k_folder_name include_subfolders='0' >
                           <li style="margin-bottom:50px;">
                               <a href="<cms:show k_page_link/>"><img src="<cms:show fotoun />" alt="<cms:show k_page_title/>" title="<cms:show k_page_title/>" border="0" /><div><i class="fa fa-link"></i></div></a>
                                <h2><a href="<cms:show k_page_link/>"><cms:show k_page_title/></a></h2>
                            </li>
                        </cms:pages>
                    </ul>
                </div><!-- End product gallery -->
            </div><!-- End related-products-container -->
        </cms:if>
    </cms:if>     
</div><!-- End content-container -->

Attachments

15 posts Page 2 of 2