This translation is older than the original page and might be outdated. See what has changed.
Translations of this page:
 

This is an old revision of the document!


loopPage()

int loopPage(int startValue, int endValue, [int increment])

int loopPage(int repetitions)

mixed loopPage(array elements/) Repeats the page – beginning with the start value – in a loop as often as it takes until the end value is reached. The current value is returned each time. * startValue
value on the first pass * endValue
value on the last pass * increment
(optional) change in value on every loop pass (standard: 1) – you can create an endless loop with the increment 0, which can be terminated using
setNextPage('next'). If only a nummeric parameter (repetitions) is specified the page will repeat as often as determined. The counter variable begins with 0 in this instance. * repetitions
number of repetitions Note: To repeat more than one page, please use
loopToPage(). ===== Example ===== <code php> PHP code on the first page in the questionnaire create, shuffle and cache list with questions $questions = array( 'AB01', 'AB02', 'AB03', 'AB04', 'AB05', 'AB06' ); shuffle($questions); registerVariable('questions');</code> <code php> PHP code later in questionnaire $i = loopPage(6); 6 repetitions - equivalent to loopPage(0,5) question($questions[$i]); </code> Note: As the same page is shown repeatedly, the response times for all repetitions are added up. You have to use multiple pages instead of loopPage()'' if you want to collect the processing times separately. <code php>
PHP code later in questionnaire - page 21 question($questions[0]); PHP code on page 22 question($questions[1]); and so on. PHP code on page 26 question($questions[5]); </code>

en/create/functions/looppage.1598473388.txt.gz · Last modified: 26.08.2020 22:23 by sophia.schauer
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki