| Recommend this page to a friend! |
| Packages of Michael Beck | Xoops 2.5 | htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-basic-syntax/language-escaping.md | Download |
|
|||||||||||||||||||||
Escaping Smarty parsingIt is sometimes desirable or even necessary to have Smarty ignore sections it would otherwise parse. A classic example is embedding Javascript or CSS code in a template. The problem arises as those languages use the { and } characters which are also the default delimiters for Smarty. > Note > > A good practice for avoiding escapement altogether is by separating > your Javascript/CSS into their own files and use standard HTML methods > to access them. This will also take advantage of browser script > caching. When you need to embed Smarty variables/functions into your > Javascript/CSS, then the following applies. In Smarty templates, the { and } braces will be ignored so long as they
are surrounded by white space. This behavior can be disabled by setting
the Smarty class variable Examples
Smarty's default delimiters { and } cleanly represent presentational
content. However, if another set of delimiters suit your needs better,
you can change them with Smarty's
> Note > > Changing delimiters affects ALL template syntax and escapement. Be > sure to clear out cache and compiled files if you decide to change > them.
Where the template is: |