Package IO\Template\loader

Package IO\Template\loader

Classes summary

This loader is to use when you load a template whose source is directly a PHP string and not a file. It supports caching and saves cache files in the /cache/tpl directory, using a md5 hash to distinguish eache string input.


This loader is the most used. It takes a file identifier as input. This identifier corresponds to a file that can be different from the user's theme. In fact, when it loads a template, its looks for it at several places. For a module template, it can be the default one which is in the /module/templates directory, but if the file is specialized by the theme, it loads it from the theme directory. All that is explained in the FileTemplate class description. This loader supports caching and stores cache files in the /cache/tpl directory, their name are related to their source's real path.


This loader is a very simple one. Its input is a string containing the template source. It doesn't supports caching so it always parses the input source.

Interfaces summary

This class is responsible to load a template and transform it in the PHPBoost parsed template syntax. Normally a loader is able to load a template and provide its parsed form. The parsing is done by a TemplateParser it embeds and is a quite heavy operation. To be more efficient, we've introduced the parsed files caching which enables us to parse each file only once and then reuse the cache. Even if the TemplateLoader interface knows the cache notion, that doesn't mean that the implementation has to support caching. It's the reason why there is the TemplateLoader::supports_caching() method.

Exceptions summary
FileTemplateLoadingException This exception is thrown when the template cannot been loaded.
TemplateLoadingException This exception is thrown when the template cannot been loaded.