Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hey there! First of all, thank you for the great work with the couch cms ;)

I´m currently running into a problem:
I just want to count the number of all cloned pages and divide it by 3 :)
I tried doing it with
Code: Select all
<cms:set page_count='0'/>
<cms:pages masterpage='project.php'>
  <cms:add pageCount '1'/>
</cms:pages>
<cms:div page_count '3'/>


However page_count does not contain the desired value, but a list of the different numbers (1 1 0 0) in my case. Am I doing something horribly wrong or is there an easier concept?

Best regards
floAr
Hello and welcome floAr :)

A more efficient way of getting the total number of pages would be to use the 'count_only' parameter of cms:pages tag e.g.
Code: Select all
<cms:pages masterpage='project.php' count_only='1' />

That said, I presume the reason why you are dividing this total by three is to list the pages in three columns. Right?

If so, please take a look at the following post that does just this (albeit for two columns but I am sure you'll manage to tweak it)
viewtopic.php?f=4&t=7600

Please let us know if you happen to require any assistance.

Thanks.
Sorry for the late answer, I was busy finishing my page ;)
I was able to find a workaround and currently use the following 'function':

Code: Select all
   <cms:set proj_count='0' />
   <cms:pages masterpage='project.php'>
      <cms:set proj_count=k_total_records scope='global'/>
   </cms:pages>
   <cms:set proj_offset='0'/>
   <cms:repeat count='3' >
      <cms:pages masterpage='project.php' offset=proj_offset limit='3'>
         <!-- Do stuff here -->
      </cms:pages>
      <cms:incr proj_offset '3'/>
   </cms:repeat>


Maybe not the most effective routine, but it works for now. I will give your suggestions a try as soon as I find myself some free time =)

Best regards
floAr
3 posts Page 1 of 1
cron