Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hello, as a typical graphic designer I'm using Couch occasionally, but have to say that it's almost a dream, clear and accessible. Probably due to my age, or because I'm a bit dumb, or both, I did not manage to have my pages which reside under a subfolder listed when in page view. Basically, I want to be able to click and browse between products which reside under the same subfolder. The code below lists all pages in the folder's two subfolders. Can anyone guide me if I'm on the right track? Or do I have to find somehow first my subfolder id and the try to list the pages?

Code: Select all
<cms:pages masterpage='products/index.php' folder=k_folder_name order="asc">
       <a href="<cms:show k_page_link />"><cms:show k_page_title /></a> -
</cms:pages>
It all depends on current view - folder-view or page-view (see Views https://docs.couchcms.com/concepts/views.html )
Code: Select all
<cms:if k_is_folder>
   <cms:set current_folder = k_folder_name />
<cms:else_if k_is_page />   
   <cms:set current_folder = k_page_foldername />
</cms:if>

<cms:pages folder = current_folder ...
Dear trendoman, than you very much, your suggestion was right to the point, and the code you've hinted at worked like a charm. The wisdom of the day: read the documentation first, and if not clear only then ask questions :) Here is the final code:
Code: Select all

<cms:if k_is_folder>
      <cms:set current_folder = k_folder_name />
             <cms:else_if k_is_page />   
                  <cms:set current_folder = k_page_foldername />
                  <div class="section-header"><h3 class="mt-6"><cms:show k_page_foldertitle /></h3></div>
                  <div class="u-cubeportfolio">
                       <div class="cbp" data-layout="grid" gridAdjustment="responsive" data-animation="quicksand" data-x-gap="20" data-y-gap="20" data-media-queries='[
                              {"width": 1900, "cols": 4},
                              {"width": 1100, "cols": 4},
                              {"width": 800, "cols": 3},
                              {"width": 480, "cols": 2},
                              {"width": 300, "cols": 1}
                            ]'>
                               <cms:pages folder = current_folder order="asc">
                                <div class="cbp-item">
                                    <a href="<cms:show k_page_link />"><img src="<cms:thumbnail product_image width='960' />" alt="<cms:show k_page_title />" /></a>
                                    <h6 class="prod-detail-text"><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h6>
                         </div>
                     </cms:pages>
              </div>
       </div>
</cms:if>
3 posts Page 1 of 1
cron