This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Template Cahing and template compile

Template Cahing and template compile

Template Cahing and template compile

Monday 24 October 2011 10:12:01 am - 4 replies


I need to understand how template cache and template compile works in eZPUblish. I have always thought that they worked together but apparently this is not the case.

We have been working on a site where we have som issues regarding our left menu which is displayed on certain pages. By activating template cache and template compile it is not able to render the left menu. By disabling templatecompile however it does include the the left menu.

ViewCaching is enabled and the pagelayout uses cache blocks.

I am running version 4.4 for this un a production site.

Update: Is it as easy as the following? template Compile makes sure that every php statement and its output is cached as pure html and template Cache makes sure that individual fragments are stored based on rights, thereby creating different sets of cached html files for each role.

Modified on Monday 24 October 2011 10:38:58 am by Lars Eirik Roenning

Monday 24 October 2011 11:17:15 am

template compile compiles your template code to php so it does not need to be interepted at every request, it generally performs better but it behaves slightly different in some edge cases usually in the case of error handling and so on.

So one way of potentially fixing it is looking for warnings and errors in both mods and make sure they are fixed.

Modified on Monday 24 October 2011 6:12:09 pm by André R

Monday 24 October 2011 2:50:27 pm

To add even a bit more explanations:

- the view cache generates one cache file per node, per user-groups-of-viewer, per view-parameters combination. It is html. It includes the output of all templates included by the node template itself

- cache blocks generate one cache file per block, per keys combination. It is html. It includes the output of all templates included inside the cache block

both are part of the "content cache".

Otoh the template cache stores one php file per original .tpl file.

I would assume that template cache does nothing if template compile is disabled, but I might be wrong...

Monday 24 October 2011 3:32:06 pm

Template cache is cache-blocks (as mentioned in site.ini), hence should work independent of interepted/compiled mode, but in edge cases slightly differently.

Monday 24 October 2011 4:42:37 pm

As André already mentioned, template output is usually borked in some weird cases which seem to crash the template compiler.

I didn't run into these issues often, but at times I did, they were always caused by some error in templates.

Recently for example, I've had a case where I accidentally left a {break} statement outside of a loop.


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from