Template Lite - the faster compiling PHP template engine

How to use groups

When you cache a template, it is important to specify a "cache id". A "cache id" is an identifier that is specific to a specific page. It makes it easy to associate templates in order to keep track of where they are in the filesystem for caching. For instance, you can put all pages for your gallery under the "gallery" group. Then when you need to clear all the pages for the gallery, you can simply call $tpl->clear_cache("gallery"). Or to clear the cache for all gallery pictures, you can call $tpl->clear_cache("gallery|pictures").

Cache ids are specified like this:

	$tpl->display("page.tpl", "compileid");
	$tpl->display("page.tpl", "cacheid");
	$tpl->display("page.tpl", "cacheid|subgroup");
This allows you to load up page.tpl and assign it different names. One time you might load it and refer to it as "page1" and the next time call it "page2".

Each group is offset by the pipe, |. In the above example, the base group for the cache id was "cacheid" and then under page you had a cache id of "subgroup". The real power of cache ids comes when you want to clear templates to be recached. For instance, you can clear the "page" group and it will remove all cached templates with the base group "page". or you can clear the "page|one" group and remove all templates under the group "page|one", instead of just removing all templates. This means that pages that don't need their cache to be regenerated aren't affected, thus increasing overall speed.