SmartyTemplate class

Smarty template abstraction.

Class Overview

Smarty template abstraction.

This class wraps a Smarty instance with some Anewt-specific helper methods.

Public Methods

SmartyTemplate($template=null, $directories=null)

Constructor for the SmartyTemplate class.

Parameters

$template

Optional parameter with the filename of the template to use. This is just a shortcut for $template->set('template', 'filename.tpl').

$directories

Optional parameter with up to four items that will be passed to SmartyTemplate::setup().

See also

setup($template_dir=null, $compile_dir=null, $config_dir=null, $cache_dir=null, $plugins_dir=null)

Configure the directories used for Smarty templates.

If parameters are omitted or if null values are supplied, the following constants are used as defaults: ANEWT_SMARTY_TEMPLATE_TEMPLATE_DIR, ANEWT_SMARTY_TEMPLATE_COMPILE_DIR, ANEWT_SMARTY_TEMPLATE_CONFIG_DIR and ANEWT_SMARTY_TEMPLATE_CACHE_DIR, ANEWT_SMARTY_TEMPLATE_PLUGIN_DIR. Define these constants in a configuration file.

Parameters

$template_dir

The directory used for templates.

$compile_dir

The directory used for compiled templates.

$config_dir

The directory used for configuration files.

$cache_dir

The directory used for cached files.

$plugins_dir

One or more directories where plugins are stored.

render($template=null)

Renders this template to a string.

Parameters

$template

The filename of the template to use.

Return value

The resulting string after rendering by Smarty.

display($template=null)

Directly renders this template.

Parameters

$template

The filename of the template to use.

See also

before_render()

Callback method before rendering starts.

This method does nothing by default. Override it if you want to do some special stuff before the actual rendering starts.

template_is_available($template=null)

Checks whether a given template is available.

Parameters

$template

The filename of the template to use.

Public Attributes

$smarty

Smarty instance.

Inheritance

Base Classes

Inherited members