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

This is an old revision of the document!


string getTextElement(string textID)

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);

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);
en/create/functions/gettextelement.1417546761.txt.gz · Last modified: 02.12.2014 19:59 by alexander.ritter
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki