====== html() ======

''void **html**(string //text//)''

Outputs HTML code in the questionnaire. This means text can be output or images can be embedded. However, it is more sensible to use HTML for designing layouts ([[:en:create:table-layout|Placing Elements Side by Side]]).


  * //text//\\ The HTML code which shall be displayed. 


===== Example =====

<code php>
html('<h1>Welcome!</h1>');
html('
  <p>Line breaks are
  not a problem here.</p>
');
</code>

===== Tips =====

**Tip:** It is better to use text elements to integrate text, images and lengthy HTML codes. These are created in **Text Elements and Labels** and dragged into the questionnaire or integrated into a questionnaire page with ''[[:en:create:functions:text|text()]]''. As a result, the questionnaire remains clear, extended functions (e.g. multilingual surveys or placeholders) are available, and you do not have to worry about using quotation marks. 

**Note:** The PHP functions ''echo'' and ''print()'' are not released for use in the questionnaire because their output would appear above the questionnaire, rather than in it. Use the function ''html()'' instead. 

**Note:** In order to use quotation marks in text which already function as a delimiter, the quotation marks have to be devaluated with a back slash  (''\''). After this, they will not be recognized as a delimiter anymore and displayed properly. 

<code php>
html('<p>This HTML code contains "double quotation marks".</p>');
html("<p>and so does &quot;this&quot;.</p>");
html('<p>This is how it works with single quotation marks</p>');
</code>

<code php>
html('<h1>Hello world!</h1>');  // single quotation marks
html("<h1>Hello world!</h1>");  // double quotation marks 
html('<h1>Hello "world"</h1>');           // right
html("<h1>Hello &quot;world&quot;</h1>"); // even more right
html("<h1>Hello "world"</h1>"); // **Wrong**, because the string
                               // is tagged with double quotation marks and
                               // double quotation marks occur within.
// Spread the string out onto multiple lines - often sensible
// But usually text() is even more sensible 
html('
  <h1>Hello world!</h1>
  <p>How are you, world?</p>
');
</code>

**Note:** Some words (e.g. "new") must not appear in PHP code because they hold a particular meaning in PHP. If one of these words appears in your text, and you definitely want to use the command ''html()'' instead of a text element, then compile the text with fragments:


<code php>
// Wrong: cannot be saved for security reasons
html('<p>This is a new car</p>');

// text() does not recognize this restriction
text('cartext');

// And this workaround also works
html('<p>This is a ne'.'w car</p>');
</code>