Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
Hello, i'm new to CouchCMS and i really like working with it so far. Thank you !!
I have a question:

i'm displaying the contents of my pages the normal way like this:

Code: Select all
<cms:pages ..>
   ...
   <cms:no_results>
      <h3>No pages found</h3>
   </cms:no_results>
</cms:pages>


And after all the pages has been fetched,i want to display a text and a link, well, actually a button, but i only want to do this if there were some pages fetched...

I can not put the code inside "the loop", since then i'll get one button per page, and if i put it after, i don't have access to no_results.

How should i do? Is there a global "results"-tag, perhaps?

Maybe a simple thing, but i'm not really a coder (and that's why i choosed to use this very nice tool to transform my static sites to dynamic ones= :)
Hi :)

Here is a tip that you may find useful -
Anytime you are unsure as to which variable could be used to implement certain functionality, try placing a <cms:dump /> (or <cms:dump_all />) tag at that place e.g. as follows -
Code: Select all
<cms:pages ..>
   ..

   <cms:dump />

   <cms:no_results>
      <h3>No pages found</h3>
   </cms:no_results>
</cms:pages>

Using the code above, you should be able to spot several variables that'd help outputting the button *after* the last page is processed.

One would be this -
Code: Select all
<cms:pages ..>
   ...
   
   <cms:if k_paginated_bottom>
    .. display button ..
   </cms:if>

   <cms:no_results>
      <h3>No pages found</h3>
   </cms:no_results>
</cms:pages>

The k_paginated_bottom variable is set to '1' only when the last item in the loop is being shown.
We can use it to display the button you need.

Hope this helps.
Perfect. it helped me a lot. I must emphasize how fun i think it is to work with this tool. Everything seems to come natural ,just like magic!

Thank you!

And, i surely will use the "dump"-tag now.
Thank you for appreciating our little CMS :)
I am glad you find it useful.
WOW :o :o
It really helped
5 posts Page 1 of 1