ezjscore template operators
This page is for designers who use the operators of the ezjscore extension, the JavaScript and CSS foundation of
Exponential. They are registered in extension/ezjscore/autoloads/eztemplateautoload.php.
Contents
Packer operators
ezscript, ezscript_require, ezscript_load, ezscriptfiles, ezcss, ezcss_require, ezcss_load, ezcssfiles:
see The ezcss and ezscript operators and
Loading stylesheets.
Encoding for scripts
| Operator | Returns |
|---|---|
json_encode | the value as JSON |
xml_encode | the value as XML |
node_encode | a node as a simple structure (for scripts that need node data) |
The CSP-safe way to give a script data is a JSON block:
<script type="application/json" id="mytheme-gallery">{json_encode( hash(
'title', $node.name,
'count', $node.children_count ) )}</script>The media design passes its video consent texts this way (pagelayout/head/script.tpl). A block of type
application/json is data, not code, so a strict Content Security Policy allows it.
has_access_to_limitation
Tells whether the current user has a policy with a given limitation; used by ezjscore-based admin interfaces. For designs, the user fetch functions are simpler (Role and policy operators).
Related pages
- No inline JavaScript
- ezjscore
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.