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

loopPage()

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

int loopPage(int repetitions)

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 one 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

// 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');
// PHP code later in questionnaire
$i = loopPage(6);  // 6 repetitions - equivalent to loopPage(0,5)
question($questions[$i]);

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.

// 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]);
en/create/functions/looppage.txt · Last modified: 14.05.2016 21:27 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki