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


string textlink(string textID, string label, [int width, int height])

It is equally possible to display text (e.g. a lengthy label) in a new window (pop-up), instead of directly in the questionnaire. The text will appear in the same layout as it would in the questionnaire.

  • textID
    ID of the text element to be shown in the pop-up window.
  • label
    Label of the hyperlink that opens the pop-up.
  • width
    Width of the pop-up window in pixels (optional).
  • height
    Height of the pop-up window in pixels (optional).


Note: This function only creates the link. You still have to place the link in the questionnaire using html() or placeholders.

Note: Only users of the questionnaire can access the text by clicking on the link generated.

Tip: The size of the new window can be specified optionally. It often makes sense to keep the window small so the questionnaire can still be seen in the background. If no size is specified, the default size of 600 × 500 pixels is used.

Tip: If you do not want to open a separate window in the questionnaire when displaying a short amount of text – who knows if the participant can find their way back to the questionnaire afterwards – then read the following chapter: Click to Get Information

Example 1

For the following example, a new text element with the ID “explanation” must be created first of all in Text Elements and Labels. After this, the following PHP code is put on a page in the questionnaire.

// Save the HTML code for the link in the PHP variable $link 
$link = textlink('explanation', 'here');
// Display the link in the questionnaire
html('<p>Please click '.$link.'</p>');

The following PHP code delivers the same result – it's just a little bit more complex.

html('<p>Please click '.textlink('explanation', 'here').'</p>');

Example 2

Often, it is simpler to place the link in the questionnaire using placeholders. The following PHP code is put above a question that uses the placeholder %link% in the question title.

replace('%link%', textlink('explanation', 'here'), 'html');

Example 3

The following PHP code opens a pop-up window with a size of 640 × 400 pixels.

$link = textlink('explanation', 'statement', 640, 400);
html('<p>If necessary, please read '.$link.'</p>');
en/create/functions/textlink.txt · Last modified: 22.01.2018 14:54 by admin
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki