Translations of this page:
 

getTextElement()

string getTextElement(string textID, [string output format])

Returns the HTML code for the text element with the ID textID as a string.

  • textID
    ID of the text element whose content is to be returned.

Note: If the text element is output in the questionnaire with a title and/or formatting, this is also included in the HTML code. However, the potential alignment (left/centred/right/justified) and the spacing below the text element are not included.

Example 1

In the following example, one of 2 text elements (“desc1” or “desc2”) is integrated into a third placeholder (“description”) via placeholder. The third text element therefore must contain the placeholder %desc%.

if (value('AB01_01') == 1) {
  $desc = getTextElement('desc1');
} else {
  $desc = getTextElement('desc2');
}
replace('%desc%', $desc);
text('description');

Example 2

In the following example, each “a” and “A” is replaced with an underscore and the text element subsequently displayed.

$content = getTextElement('priming');
$out = str_replace(array('a','A'), '_', $content);
html($out);
en/create/functions/gettextelement.txt · Last modified: 26.09.2020 13:50 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