Translations of this page:

Randomization: Texts

Note: This page explains how to randomize texts with a Random Generator and some PHP code. Since this is already the 2nd step of the procedure, please read the Randomization with PHP-Code page first.

If your stimulus is a text, the function text() must be used when including it via PHP code. This function embeds the HTML code as a text module in a page.

At first you need to create a random generator (siehe Randomisierung mit PHP-Code). The next step is to create the stimulus texts as Text in the List of Questions. After that, when Compose Questionnaire, you place a PHP code on the page under the random generator. This code might look like this:

if (value('RG01') == 2) {
} elseif (value('RG01') == 3) {

With this PHP code, the group “Positive case studies” (random generator value RG01=2) would display the text with the ID “ST01”, the group “Negative case studies” (random generator value RG01=3) would display the text with the ID “ST02”, and the control group (random generator value RG01=1) would display nothing.

en/create/randomization-text.txt · Last modified: 14.02.2021 20:37 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