This is an old revision of the document!
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
setNextPage('next')
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 .
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
loopToPage()
number of repetitions
Note: To repeat more than one page, please use .
===== 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>