The second edition of LiveWhale's First Friday Forum, a place for us to share tips and tricks for using LiveWhale (and for you to show us cool stuff that you've done).
This forum is devoted to Templates. Laura covers the basics of template creation and provides details of template enhancements in the latest release, LiveWhale 1.5.1
Questions from the forum:
Q. Are there are any tips for template creation when it's really complex php code being used?
A. This is really where applications come in. Applications are designed to abstract all the PHP code from the page itself. This separation allows you to freely use templates without complications stemming from PHP code. It’s also ideal to have PHP code maintained separately from the template and not have to push PHP code updates out to pages.
When you create an application, it’s designed to populate XPHP variables which your template contains. In this manner, output from the application gets injected safely and efficiently into the template, and you only need to maintain those variables in your template.
To make it contextual, the application can execute code according to such rules as: which page is currently being requested, what directory the currently requested page falls under, whether a particular class is found on the page being requested, etc..
If you do not wish to write an application, the alternative is to add either a PHP style include in your template (outside of an editable element) or, add a file widget that points to an HTTP url of a PHP script (only if explicitly needed — not recommended for performance reasons), or simply exclude pages requiring custom inline PHP templating.