Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Could it be, that startcount doesn't work with show_repeatable?

Example:
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
  <cms:template title='hompage'/>
  <!doctype html>
  <html>
  <head><title>Test</title>
  <body>
  <cms:hide>
  <cms:repeatable 'contacts'>
    <cms:editable name='text' type='text'/>
  </cms:repeatable>
  </cms:hide>

  <cms:show_repeatable 'contacts' startcount='1' limit='1'>
  <cms:show text /><br>
  </cms:show_repeatable>

  <cms:show_repeatable 'contacts' startcount='2' limit='1'>
  <cms:show text /><br>
  </cms:show_repeatable>

  <cms:show_repeatable 'contacts' startcount='3' limit='1'>
  <cms:show text />
  </cms:show_repeatable>
  </body>
  </head>

<?php COUCH::invoke(); ?>


When I add 3 values, always the first value is shown.
SimonWpt wrote: Could it be, that startcount doesn't work with show_repeatable?


Offset works:
Code: Select all
  <cms:show_repeatable 'contacts' offset='0' limit='1'>
  <cms:show text /><br>
  </cms:show_repeatable>

  <cms:show_repeatable 'contacts' offset='1' limit='1'>
  <cms:show text /><br>
  </cms:show_repeatable>

  <cms:show_repeatable 'contacts' offset='2' limit='1'>
  <cms:show text />
  </cms:show_repeatable>
Hi,

If you place a <cms:dump /> within <cms:show_repeatable>, you'll find that one of the variable it sets is 'k_count'.
The value of this variable is '1' in the first iteration and keeps increasing with each row.

The 'startcount' param serves to set the initial value of k_count (default value being '1').
So, startcount='0' will make k_count go 0, 1, 2 etc. while startcount='3' will make it 3, 4, 5 and so on.

Hope this clears your doubt.
@kk Thank you, now I understand the function of the parameter.
4 posts Page 1 of 1
cron