Wednesday 24 January 2007 5:05:00 pm
eZ Publish has its own powerful template language. This section looks at a few cases where you can improve site performance by optimizing the templates.
The eZ Publish template language should not be treated as a general-purpose programming language. When application logic is added to the template itself it reduces website performance. An example of sub-optimal logic in templates is:
This scenario is not desirable for the following reasons:
It is bad practice to have logic like this in the template itself. In cases where you find yourself adding more and more logic to the template code, ask yourself whether it can be implemented as a separate module, template operator or as an extension to eZ Publish. Doing the example above in pure SQL with a template operator is many times faster than doing it in the template.