Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
en:create:functions:getitemtext [24.01.2015 15:42] – [Example 1] alexander.ritter | en:create:functions:getitemtext [24.01.2015 15:44] – [Example 1] alexander.ritter |
---|
===== Example 1 ===== | ===== Example 1 ===== |
| |
In the following example, question "AB01" is a lengthier drop-down selection (on page 1 in the questionnaire). The respondent selects his favourite television program in the question. The question is set so that the respondent must give a response. The title of the program will be shown in question "AB02". Thus, "AB02" has a placeholder ''%title%'' in the question title. | In the following example, question "AB01" is a lengthier drop-down selection (on page 1 in the questionnaire). The respondent selects his favourite television program. The question is set so that the respondent must give a response. The title of the program will be shown in question "AB02". Thus, "AB02" has a placeholder ''%title%'' in the question title. |
| |
In order for the placeholder to display the title, the selected title has to be identified initially with ''getItemtext()'' , and set up as placeholder with ''[[:en:create:functions:replace|replace()]]''. The following PHP code is put on page 2 or later on: | In order for the placeholder to display the title, the selected title has to be identified initially with ''getItemtext()'' , and set up as placeholder with ''[[:en:create:functions:replace|replace()]]''. The following PHP code is put on page 2 or later on: |
<code php> | <code php> |
$selection = value('AB01'); // respondent's selection (answer code = item) | $selection = value('AB01'); // respondent's selection (answer code = item) |
$titel = getItemtext('AB01', $auswahl); | $title = getItemtext('AB01', $selection); |
replace('%title%', $title); // set up placeholder | replace('%title%', $title); // set up placeholder |
question('AB02'); // ask question AB02 | question('AB02'); // ask question AB02 |