~~NOTOC~~ ====== textlink() ====== ''string **textlink**(string //textID//, mixed //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 (text or HTML code) that opens the pop-up. * -- Label independent of the language version * -- Label according to language version. The ID of the language version (e.g. ''"ger"'' or ''"eng"'') is used as the key of the array, the actual label is used as the associated value. * //width//\\ Width of the pop-up window in [[:en:glossary#pixel|pixels]] (optional). * //height//\\ Height of the pop-up window in pixels (optional). ===== Tips ===== **Note:** This function only creates the link. You still have to place the link in the questionnaire using ''[[:en:create:functions:text|html()]]'' or [[:en:create:placeholders|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: [[:en:create:popup|Click to Get Information]] ===== General Example ===== 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('

Please click '.$link.'

');
The following PHP code delivers the same result -- it's just a little bit more complex. html('

Please click '.textlink('explanation', 'here').'

');
===== Link as Placeholder ===== 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'); ===== Control the size of the pop-up ===== The following PHP code opens a pop-up window with a size of 640 × 400 pixels. $link = textlink('explanation', 'statement', 640, 400); html('

If necessary, please read '.$link.'

');
===== Multilingual Surveys ===== Depending on the language version, either "Text nochmal zeigen" or "Display Text Again" is displayed as a link. $link = textlink('stimulus', array( 'ger' => 'Text nochmal zeigen', 'eng' => 'Display the Text Again' )); html('

'.stimulus.'

');