Interface

TemplateLoader

Package: IO\Template\loader Copyright: © 2005-2019 PHPBoost License: GNU/GPL-3.0 Author: Loic ROUCHON horn@phpboost.com Version: PHPBoost 5.2 - last update: 2014 12 22 Since: PHPBoost 3.0 - 2009 06 18 Contributor: Benoit SAUTEL ben.popeye@phpboost.com Located at: io/template/loader/TemplateLoader.class.php

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.

Methods summary
public string
# load( )

Loads the template.

public boolean
# supports_caching( )

Tells whether the loader supports caching. If it supports it, its TemplateLoader::get_cache_file_path() will have to return a non-empty value.

public string
# get_cache_file_path( )

Returns the path of the cache file that can be directly executed by the include PHP instruction. This method must be called only if the loader supports caching, the TemplateLoader::supports_caching() enabled you to know that.