Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
en:create:functions:registervariable [24.12.2014 17:23] – [Example 3] alexander.ritter | en:create:functions:registervariable [04.03.2016 14:57] – [Example 3] wrong function call (variableRegister instead of registerVariable) cristinamendonca |
---|
''void **registerVariable**(string //variableName//)'' | ''void **registerVariable**(string //variableName//)'' |
| |
In PHP, a variable is normally only valid within __one__ PHP code element. By using ''registerVariable()'' , a variable can be made available for all following PHP code elements. | In PHP, a variable is normally only valid within __one__ PHP code element. By using ''registerVariable()'', a variable can be made available for all following PHP code elements. |
| |
* //variableName//\\ A string (in quotation marks) with the name of the variable. This cannot be the variable itself (e.g. ''$item''), a string with the name of the variable (e.g. 'item'). | * //variableName//\\ A string (in quotation marks) with the name of the variable. This cannot be the variable itself (e.g. ''$item''), a string with the name of the variable (e.g. 'item'). |
===== Example 1 ===== | ===== Example 1 ===== |
| |
In the following example, three items are taken from the items in question "AB01" on page 1. Following this, the question is asked with these three items -- and, on a later page, question "ABO2" is asked with these exact same three items. | In the following example, on page 1, three items are taken from the items in question "AB01". Following this, the question is asked with these three items -- and, on a later page, question "ABO2" is asked with these exact same three items. |
| |
| |
===== Example 2 ===== | ===== Example 2 ===== |
| |
On page 4 in the questionnaire, a rather complicated filter is used to determine whether the participant falls into group 1 (prospective clients or clients preparing to do business), or group 2 (current client). Different questions will be shown later on the in the questionnaire resulting from this classification. | On page 4 in the questionnaire, a rather complicated filter is used to determine whether the participant falls into group 1 (prospective clients or clients preparing to do business), or group 2 (current clients). Different questions will be shown later on the in the questionnaire resulting from this classification. |
| |
<code php> | <code php> |
); | ); |
shuffle($questions); | shuffle($questions); |
variableRegister('questions'); | registerVariable('questions'); |
</code> | </code> |
| |