[ar] [ast] [bg] [br] [ca] [co] [cpf] [cs] [da] [de] [en] [eo] [es] [eu] [fa] [fon] [fr] [gl] [id] [it] [ja] [lb] [nl] [oc] [pl] [pt] [ro] [ru] [sk] [sv] [tr] [vi] [zh] Espace de traduction



June 2010

All the versions of this article:

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.

Show the template of this page Site powered by SPIP | Translation area | Private area