Template class

The following sections explain each method of the class.

setSkin


public void setSkin ( string $skin)

Sets the current skin for the template path. By default, the skin is welcome from webpackages set. That is, the templates are in the folder structure package/views/welcome/ wanted.

Parameter list
The skin is defined to call. This value is set automatically when the constant TEMPLATE_DEFAULT_SKIN filled.

setHeaderFile


public void setHeaderFile ( string $header)

In webpackages a page builds by 3 template files. The header then the dynamic template file and the fitting, the footer template file. All three templates give the page that is displayed in the browser. Here the standard header template file to be determined. Only the name of the template (with file extension) must be specified.

Parameter list
header

The name of the header templates


setFooterFile


public void setFooterFile ( string $footer)

In webpackages a page builds by 3 template files. The header then the dynamic template file and the fitting, the footer template file. All three templates give the page that is displayed in the browser. Here the standard footer template file to be determined. Only the name of the template (with file extension) must be specified.

Parameter list
footer

The name of the Footer Templates


setTemplateDir


public void setTemplateDir ( string $dir)

The absolute path to the template directory in webpackages Framework. This method is called automatically when the constant TEMPLATE_DIR filled. It should only go to the skin, not on.

Parameter list
dir

The absolute path to the template directory. Not until the skin.


setData


public void setData ( array $datas)

An associative array of data that are converted to PHP variables and thus are in the template are available. Thus, one can transmit generated values from the model and controller to the view (Templates).

Parameter list
datas

An associative array with key as PHP variables name and value as the content of the variable.


setSingleData (from v2.5.0)


public void setSingleData ( string $key, string $value)

If you only a $key and $value want to insert value, you can setSingleData use Method.

Parameter list
key

The key concept under which one finds the variable in the template.

value

The value or contents of the key, or the tag in the template.


getTemplatePath


public string getTemplatePath ( )

Returns the absolute path back to the current template directory.


displayPlugin


public void displayPlugin(string $template, bool $cacheActive = false, int $cacheExpiresTime = 0)

Can be used to represent Plugin templates. Since the normal method display only in the current template directory for the right template looks. Could one use an absolute path to the template to represent it.

Parameter list
template

The absolute path to the template is to be displayed.

cacheActive

Whether the template is to be cached. Thus, the PHP content is parsed on each call is not always again in the template.

cacheExpiresTimes

The duration which the template is to be cached before being parsed again.


display


public void display(string $template, string $header = null, string $footer = null, bool $cacheActive = false, int $cacheExpiresTime = 0)

Represents a template from the current template directory.

Parameter list
template

The relative path (starting from the template directory) to be called Template.

header

The header is to be displayed on the template. If null is specified, the standard header is taken.

footer

The footer is to be displayed below the template. If null is specified, the default is taken Footer.

cacheActive

Whether the template is to be cached. Thus, the PHP content is parsed on each call is not always again in the template.

cacheExpiresTimes

The duration which the template is to be cached before being parsed again.


load_template_file


public string load_template_file(string $file, string $type, string $dir = '', bool $minify = true)

Loads a template file required. For example, a JavaScript, CSS or just an image file. The content is also Minimizes and cached and displayed Optimized.

Parameter list
file

The relative filename for the template directory with file extension.

type

What for a file type it is. Allowed are css , js and omg .

dir

The directory in which the file to search for. For example the image in the template root directory in the ,,img" folder, you must specify here ,,img". It is worth noting that you can jump back no directories.

minify

Allows for file types with js or code the code to optimize. Voids, comments and adjustments for better readability of the code be removed for optimization purposes.