Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
I want <h2> What we do </h2> to only show if <cms:pages>......</cms:pages> is not empty. I've tried all I could but to no avail. Any help?
Code: Select all
   
<h2>What we do</h2>

<div>
      <cms:if k_is_list>
<cms:pages masterpage="procap-single-service.php" folder=k_folder_name include_subfolders='1'>
      <div gy="c-4">
            <div>
               <a href="<cms:show k_page_link />">
                  <img src="img/expertise.jpg">
                  <h3><cms:show k_page_title /></h3>
                  </a>
            </div>
      </div>
   </cms:pages>
   </cms:if>
Use inside cms:pages its variable k_paginated_top , that appears only once if there are pages.
Thanks Trendoman, but can I get a practical use code (a working code)?
Code: Select all
<cms:if k_is_list>
    <cms:pages masterpage="procap-single-service.php" folder=k_folder_name include_subfolders='1'>

        <!-- this block will be outputted only once (for the first page) -->
        <cms:if k_paginated_top >
            <h2>What we do</h2>
        </cms:if>
       
        <!-- this block will be repeated for each page -->
        <div gy="c-4">
            <div>
                <a href="<cms:show k_page_link />">
                    <img src="img/expertise.jpg">
                    <h3><cms:show k_page_title /></h3>
                </a>
            </div>
        </div>
       
        <!-- this block will be outputted only once (for the last page) -->
        <cms:if k_paginated_bottom >
            <!-- do something -->
        </cms:if>
       
        <!-- this block will be outputted if there are no pages to list -->
        <cms:no_results>
            <!-- do something -->
        </cms:no_results>

    </cms:pages>
</cms:if>

Hope it helps.
4 posts Page 1 of 1

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 3 guests