JESI Codeblock
"Marc Cardle" <[email protected]>
| Newsgroups | gmane.comp.cms.jahia.template |
|---|---|
| Message-ID | <058a01c6fc42$d9ccb330$2f01a8c0@Dellprecision> |
Hi,
We've had a few questions regarding the jesi:codeblock tag used for ESI
caching, so here are answers to these questions:
Is <jesi:codeblock execute="always"> equivalent to <jesi:control cache="no">
or <jesi:template cache="no">?
No. The codeblock tag only dictates which blocks of code should be executed
when an uncached template/fragment is requested. So if the fragment/template
is cached on the ESI server, the code in the codeblock tag will not be
executed no matter what the 'execute' attribute is set to.
Is <jesi:codeblock execute="template"> equivalent putting no tag at all?
Yes.
The documentation for codeblock is available here
http://www.jahia.org/jahia/webdav/site/jahia_org/shared/documentation/templa
te/jesi-tutorial-v0.1.3.pdf
Pasted below is the relevant section :
1) Codeblock Tag
You can optionally use codeblock tags within the template tag, outside of
any fragments, to mark conditional execution of blocks of code.
To avoid needlessly repeating the execution of expensive template code,
strategically place the code within JESI codeblock tags. Configure each
codeblock tag according to when you want the code within it to be executed
(whenever the template is requested, whenever a fragment is requested, or
always).
<jesi:template ... >
...
<jesi:codeblock execute = "template" | "fragment" | "always" >
...request-dependent JSP content...
</jesi:codeblock> ...
</jesi:template>
* template: The enclosed code will only be executed when the current
request is requesting the template. This is equivalent to not putting a
codeblock tag around the code.
* fragment: The enclosed code will only be executed when a fragment
is being fetched, but won't be executed when the template is requested.
* always: The enclosed code is always executed (for both fragment and
template requests).
Its behaviour is identical to that described in
http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/lo
cale.en/vtTopicFile.developing_with_ojsp%7Cjesitags%7Ehtml/navId.4/navSetId.
_/
To maximally boost performance, we highly recommend using this tag profusely
(yet thoughtfully).
Regards,
Marc