The |texte_script filter transforms tag output into a character string that can be used in complete security by a PHP or JavaScript script.

The following PHP script provides an example:

<?php $x = '[(#TEXTE|texte_script)]'; ?>

Attention: make sure to use the ’ (simple quote) character and not the " (double quote) character to delimit your PHP variable. In fact, if you used the double quote and your text contained the $ sign, the result could be quite catastrophic (partial display, display of something else, PHP crashing, etc.).

Applied to a tag in an HTML template, unrelated to a JS or PHP script, this filter simply resorts to escaping any apostrophe in the text, e.g. Daniel\'s new car.

Author Mark Published : Updated : 26/10/12

Translations : català, English, Español, français, Nederlands