Snippets

A snippet is a short piece of PHP which performs some operation and outputs the results to the page, like placeholders snippets may be included in the cached page data or uncached so they are run on each page view.

Snippets come in three flavors; those are part of the core system, those that are provided by modules and those that you write yourself.

Note: Snippets that you create yourself in the manager override snippets of the same name from any other source.

Snippets can be passed parameters in the form &name=`value`, the following examples show the possible formats:

[[test]] - Cached snippet
[[!test]] - Uncached snippet
[[test &item=`123`]] - Cached snippet being passed a value
[[module.snippet]] - Cached snippet from a specific module
[[test &value=`12` &value2=`45` &value3=`67`]] - Multiple parameters

When a snippet is called it is passed $tplEngine which is the instance of cfTemplateEngine running the template and all parameters passed in the call are converted to PHP variables.




TOP