PHPackages                             wernerwa/pat-template - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. wernerwa/pat-template

ActiveLibrary

wernerwa/pat-template
=====================

patTemplate is a powerful, non-compiling templating engine, that uses XML tags to divide a document into different parts.

3.2.3(2y ago)3816↓100%3[1 issues](https://github.com/wernerwa/pat-template/issues)LGPL-3.0-or-laterPHPPHP &gt;=5.3

Since Aug 2Pushed 2y ago1 watchersCompare

[ Source](https://github.com/wernerwa/pat-template)[ Packagist](https://packagist.org/packages/wernerwa/pat-template)[ RSS](/packages/wernerwa-pat-template/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (17)Used By (0)

patTemplate Introduction
========================

[](#pattemplate-introduction)

patTemplate helps you separating the business logic from the layout and the content of your websites.

Using patTemplate, you will no more embed PHP code directly in your HTML code. Instead you will insert placeholders in your HTML documents, which will be replaced by the actual computed values by your PHP application.

The wiki is archived at

patTemplate works with PHP 5.1-8.3

patTemplate for the designer
----------------------------

[](#pattemplate-for-the-designer)

patTemplate offers you XML-based markup tags to access different parts of your layout files so you can hide, exchange or even repeat parts. This means, that your HTML-designers will need to learn some new tags and their usage. However they do **not** need to learn a new programming language. In contrast to other template engines, patTemplate takes a declarative approach for the template tags, you will not find any `if/else` statements or `for`-loops in the templates.

patTemplate for the developer
-----------------------------

[](#pattemplate-for-the-developer)

If your designer is familiar with the patTemplate syntax, you will have to learn the PHP-API of patTemplate in order to assign the actual values of the placeholders to the template. If you are an experienced PHP developer you will easily grasp the API, as you will not need to learn a lot of new methods.

Getting Started
===============

[](#getting-started)

patTemplate allows you to split a page into several blocks, called *templates*. It requires you to at least specify one block that contains the complete page, the *root* template. Inside this template, you may nest as many templates, as you like. Each of these templates should have its unique name, so it can be addressed from your PHP application. To mark a template in your page, you need to enclose the HTML code in a `` tag:

```

  This is the main page.

    It contains another template.

    And one more.

```

Loading this template from a file is easy. You only need to create a new instance of `patTemplate` and pass the filename to the `readTemplatesFromInput` method:

```
$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput('my-templates.tmpl');
```

patTemplate will now open the file *my-templates.tmpl* and scan it for `` tags. It will create a structure like this:

```
+ page
  + foo
  + bar

```

If you want to send the HTML content to the browser, you need to call the `displayParsedTemplate()` method and pass the name of the template to display:

```
$tmpl->displayParsedTemplate('page');
```

When parsing and displaying a template, all nested templates will be displayed as well. So calling this method will display:

```
  This is the main page.
    It contains another template.
    And one more.

```

If you do not want to echo the HTML code, but store it in a PHP variable, you may call `getParsedTemplate()` instead. If you do not pass the name of a template to `displayParsedTemplate()` or `getParsedTemplate()`, patTemplate will display the root template (i.e. the first template it read after creating the patTemplate object).

Chosing a directory for your templates
--------------------------------------

[](#chosing-a-directory-for-your-templates)

You will certainly not put your template files into the root directory of your webspace, but rather in a folder called *templates* or something similar. If you do not want to specify the full path to the files for every call to `readTemplatesFromInput()` you may use the `setRoot()` method:

```
$tmpl = new patTemplate();
$tmpl->setRoot('/path/to/templates');
$tmpl->readTemplatesFromInput('my-template.tmpl');
```

This example will load the templates from the file */path/to/templates/my-template.tmpl*.

The following pages will show you, how to add variables, or use different template types in your pages.

Adding variables to the template
================================

[](#adding-variables-to-the-template)

Variables are placeholders in your templates that you may assign any value from your PHP application.

There are two types of variables in patTemplate:

1. Local variables, that are only available in the template that they have been added to
2. Global variables, that are available in all templates`

To place a variable in a template, you need to enclose the variable in curly braces. Variables may only consist of uppercase letters, number, dashes and the uderscore:

```

  Hello {NAME}.

```

This template contains a variable called } that you may assign a value from your application.

Adding a local variable with addVar()
-------------------------------------

[](#adding-a-local-variable-with-addvar)

When adding a local variable, you have to use the `addVar()` method and pass the name of the template, where you want to add variable, the name of the variable as well as the value you want to assign:

```
$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput('my-template.tmpl');
$tmpl->addVar('page', 'NAME', 'Stephan');
$tmpl->displayParsedTemplate();
```

This script will display:

```
Hello Stephan.

```

Instead of a string, you may also pass an array containing several values. In this case, patTemplate will repeat the template to which the variable has been assigned for each entry on your array. Change only one line of code to add more than one name:

```
$tmpl->addVar('page', 'NAME', array('Stephan', 'Sebastian'));
```

Now the script will display:

```
Hello Stephan.
Hello Sebastian.

```

No need to create a for loop, neither in your PHP application, nor in your template file.

### Adding several variables at once with addVars()

[](#adding-several-variables-at-once-with-addvars)

A template need not only contain one variable, it can contain as many of them, as you like:

```

  {GREETING} {NAME}.

```

Instead of two calls to `addVar()` you may also pass an associative array to the `addVars()`method:

```
$vars = array(
    'GREETING' => 'Guten Tag',
    'NAME'     => 'Stephan'
);
$tmpl->addVars('page', $vars);
```

This will add two variables (GREETING and NAME) to the template *page* and display:

```
Guten Tag Stephan.

```

It is also possible to assign more than one value to a variable using `addVars()`:

```
$vars = array(
    'GREETING' => array('Guten Tag', 'Bonjour'),
    'NAME'     => array('Stephan', 'Sebastian')
);
$tmpl->addVars('page', $vars);
```

This will display:

```
Guten Tag Stephan.
Bonjour Sebastian.

```

If you assign an array to one variable and a string to the other, patTemplate will use the same string for each iteration:

```
$vars = array(
    'GREETING' => 'Hello',
    'NAME'     => array('Stephan', 'Sebastian')
);
$tmpl->addVars('page', $vars);
```

This example will display:

```
Hello Stephan.
Hello Sebastian.

```

### Adding rows of variables with addRows()

[](#adding-rows-of-variables-with-addrows)

Often, you are confronted with record sets in the following structure:

```
$data = array(
    array('name' => 'Stephan Schmidt', 'id' => 'schst'),
    array('name' => 'Sebastian Mordziol', 'id' => 'argh'),
    array('name' => 'Gerd Schaufelberger', 'id' => 'gerd')
);
```

If you want to create an HTML-table containing this information, you can use the `addRows()` method and the following template:

```

    User-Id
    Name

    {USER_ID}
    {USER_NAME}

```

This page consists of two templates, the root template (*page*) and template, that should be repeated for each record set in your array (*entry*). To build a list containing all record sets, you only need to call one method:

```
$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput('my-template.tmpl');
$tmpl->addRows('entry', $data, 'USER_');
$tmpl->displayParsedTemplate();
```

The method accepts three arguments:

- The name of the template
- An array containing all record sets
- An optional prefix for the variable names

The method is perfectly suited to create lists from database result sets, like they are returned by [PEAR DB's getAll()](http://pear.php.net/manual/en/package.database.db.db-common.getall.php)method.

### Adding objects with addObject()

[](#adding-objects-with-addobject)

Instead of using an associative array, you may also work with an object instead.

Imagine, you are using the following class in your application:

```
class User {
    public $id;
    public $name;

    public function __construct($id, $name) {
        $this->id = $id;
        $this->name = $name;
    }
}
```

And you created a template to display user information:

```

    Id:
    {USER_ID}

    Name:
    {USER_NAME}

```

You may now pass instance of the `User` class directly to the template:

```
$schst = new User('schst', 'Stephan Schmidt');

$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput('user-info.tmpl');
$tmpl->addObject('user-info', $schst, 'USER_');
```

This will display:

```
Id:   schst
Name: Stephan Schmidt

```

patTemplate will extract all properties that are marked as `public` and add them to the specified template while prefixing them as you have seen in the `addRows()` example. If you do not want to declare your properties as `public`, you may as well implement a `getVars()` method in your class that returns an associative array containing the variables that should be added to the template:

```
class User {

    private $id;
    private $name;

    public function __construct($id, $name) {
        $this->id = $id;
        $this->name = $name;
    }

    /**
    * This method will be invoked by patTemplate if the
    * object is passed to addObject()
    */
    public function getVars() {
        return array(
            'id'   => $this->id,
            'name' => $this->name
        );
    }
}
```

The result will be exactly the same.

Adding global variables with addGlobalVar() and addGlobalVars()
---------------------------------------------------------------

[](#adding-global-variables-with-addglobalvar-and-addglobalvars)

If you want to use a variable in every template block of a page, it can get cumbersome to use any of the above methods to add this variable to every template. Instead, you may use the methods `addGlobalVar()` or `addGlobalVars()` to add the variable to *every* template in your page:

The variable `{NOW}` may now be used in all of your templates:

There are two differences between the methods for local and global variables:

1. The global methods **do not** need the template name as the first parameter.
2. The global methods **do not** accept an array as values of variables.

If a variable-name is used globally and locally, the local variable has precedence.

Further Reading
---------------

[](#further-reading)

For more information on variables you might want to read:

- [Setting default values](https://web.archive.org/web/20141220075623/http://trac.php-tools.net/patTemplate/wiki/Docs/Variables/DefaultValue)
- [Accessing variables from other templates](https://web.archive.org/web/20141220075623/http://trac.php-tools.net/patTemplate/wiki/Docs/Variables/DotSyntax)
- [Variable Modifiers](https://web.archive.org/web/20141220075623/http://trac.php-tools.net/patTemplate/wiki/Docs/Advanced/Modifiers)

Setting Default Values for Variables
====================================

[](#setting-default-values-for-variables)

When using the `` tag to include a variable in a template, it is possible to specify a default value, that will be used when no value is assigned to this variable from PHP. This can be achieved using the `default` attribute:

```

  Hello .

```

As long, as no value is assigned to the variable `user`, this page will display:

```
Hello Guest.

```

Using the return value of a function
------------------------------------

[](#using-the-return-value-of-a-function)

Since revision \[438\] (or patTemplate 3.1.0a3), it is possible to specify a PHP function or a static method that will be used to generate the default value for the variable. Again, the `default` attribute can be used:

```

  The current time is .

```

This way you can include the current UNIX timestamp without having to write PHP code. As this poses a security risk (your template designers my call any PHP function), you have to enable this feature, so it can be used in the templates:

```
$tmpl = new patTemplate();
$tmpl->setOption('allowFunctionsAsDefault', true);
```

To call a static method instead of a function, you need to specify the class name and the method name, separated by two colons:

```

  The current time is .

```

The functions and methods will be evaluated, when the template is read from the file. You are not able to access the value of the variable from this function. This is what [variable modifiers](https://web.archive.org/web/20141220114048/http://trac.php-tools.net/patTemplate/wiki/Docs/Advanced/Modifiers) should be used for.

Accessing variables from other templates
========================================

[](#accessing-variables-from-other-templates)

There are two situations, in which you may want to access the variables from any other template:

1. Display the value of the variable
2. Use the value as a condition for a condition template

In both situations, you can use the *dot-syntax* to solve the problem.

Importing variables from other templates
----------------------------------------

[](#importing-variables-from-other-templates)

To import one variable from a different template into the current template, you must use the `` tag with the `copyFrom` attribute:

PHP-Code:

```
$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput('myPage.tmpl');
$tmpl->addVar('header', 'TITLE', 'Page title');
$tmpl->displayParsedTemplate();
```

Template:

```

    {TITLE}

```

In the above example, we are importing the variable `TITLE` from the template `header` into the template `footer` and name the imported value `copiedVar`. We could also apply a [variable modifier](https://web.archive.org/web/20141220114113/http://trac.php-tools.net/patTemplate/wiki/Docs/Advanced/Modifiers) to the copied variable. Since revision \[437\] it is also possible to use `__parent.VARNAME` to fetch any variable from the parent template without specifying the name of the template.

Using the dot-syntax in conditions
----------------------------------

[](#using-the-dot-syntax-in-conditions)

When creating a [condition template](https://web.archive.org/web/20141220114113/http://trac.php-tools.net/patTemplate/wiki/Docs/Templates/Condition) you may use the *dot-syntax* in the `conditionVar` attribute:

```

    {TITLE}

      Display on the homepage.

      Display on all other pages.

```

The output of the `footer` template will now depend on the value you assign to the variable `TITLE` of the `header` template.

Creating templates
==================

[](#creating-templates)

patTemplate allows you to split a page into several blocks, called *templates*. It requires you to at least specify one block that contains the complete page, the *root* template. Inside this template, you may nest as many templates, as you like. Each of these templates should have its unique name, so it can be addressed from your PHP application. To mark a template in your page, you need to enclose the HTML code in a `` tag:

```

  This is the main page.

    It contains another template.

    And one more.

```

Loading this template from a file is easy:

```
$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput('my-templates.tmpl');
```

patTemplate will now open the file *my-templates.tmpl* and scan it for `` tags. It will create a structure like this:

```
+ page
  + foo
  + bar

```

If you want to send the HTML content to the browser, you need to call the `displayParsedTemplate()` method and pass the name of the template to display:

```
$tmpl->displayParsedTemplate('page');
```

When parsing and displaying a template, all nested templates will be displayed as well. So calling this method will display:

```
  This is the main page.
    It contains another template.
    And one more.

```

If you do not want to echo the HTML code, but store it in a PHP variable, you may call `getParsedTemplate()` instead. If you do not pass the name of a template to `displayParsedTemplate()` or `getParsedTemplate()`, patTemplate will display the root template (i.e. the first template it read after creating the patTemplate object).

Chosing a directory for your templates
--------------------------------------

[](#chosing-a-directory-for-your-templates-1)

You will certainly not put your template files into the root directory of your webspace, but rather in a folder called *templates* or something similar. If you do not want to specify the full path to the files for every call to `readTemplatesFromInput()` you may use the `setRoot()` method:

```
$tmpl = new patTemplate();
$tmpl->setRoot('/path/to/templates');
$tmpl->readTemplatesFromInput('my-template.tmpl');
```

This example will load the templates from the file */path/to/templates/my-template.tmpl*.

patTemplate also allows you to read the templates not only from the file system, but virtually \[wiki:Docs/Advanced/Reader any data source\].

Further reading
---------------

[](#further-reading-1)

Of course, this is not all the functionality that patTemplate provides. patTemplate provides different *types* of templates, that come with different functionality:

- The \[wiki:Docs/Templates/SimpleCondition simpleCondition\] template allows you to emulate an `if` statement.
- The \[wiki:Docs/Templates/Condition condition\] template allows you to emulate `if/else` and `switch/case` statements.
- The \[wiki:Docs/Templates/Modulo modulo\] template allows you to create templates to represent alternating lists.

Besides the `tmpl` tag there are \[wiki:Docs/TagReference several other tags\] and it is even possible to \[wiki:Docs/Developer/CustomFunctions create your own tags\].

The !SimpleCondition template
=============================

[](#the-simplecondition-template)

In nearly every application, there will be parts of the HTML frontend, that should only be displayed, if a certain information is available. One example could be a box, that displays information about the currently logged in user. It makes no sense, to display this box, if no user is logged in.

patTemplate helps you achieving this, by providing the *simpleCondition template*.

Take a look at the following template:

```

  Here is your main content.

      Logged in as {USER_NAME} ({USER_ID}).

```

To add user information to this page, you need to use the `addVars()` method, like the following code snippet shows:

```
$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput('my-template.tmpl');
if (userIsLoggedIn()) {
  $user = array(
             'ID'   => getUserId(),
             'NAME' => getUserName()
          );
  $tmpl->addVars('user-info', $user, 'USER_');
}
```

The problem is, that if there is no user logged in, that the HTML code for the user info box will still be displayed. This can easily be changed, by adding two attributes to the `` tag:

```

  Here is your main content.

      Logged in as {USER_NAME} ({USER_ID}).

```

By setting the `type` attribute to `simpleCondition` you are emulating an `if`-condition. The attribute `requiredVars` allows you to specify a variable that must be assigned a non-empty value in order for the template to be displayed. By setting this attribute to `USER_ID` you can force this template to be hidden, if no user-id has been passed.

Specifying more than one variable
---------------------------------

[](#specifying-more-than-one-variable)

It is also possible to specify more than one variable. In this case you have to set the attribute value to a comma-separated list of variable names. If any of the variables has a non-empty value, the template will be displayed:

```

  Here is your main content.

      Logged in as {USER_NAME} ({USER_ID}).

```

In this example, the user-info box will be displayed, if either the username or the userid has been set.

Using global variables
----------------------

[](#using-global-variables)

If you want to display the userid and username in different places in your template, you might want to add it globally:

```
$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput('my-template.tmpl');
if (userIsLoggedIn()) {
  $user = array(
             'ID'   => getUserId(),
             'NAME' => getUserName()
          );
  $tmpl->addGlobalVars($user, 'USER_');
}
```

By ddefault, the *simpleCondition template* will check, whether the variable has been asigned **locally**. This can be changed, by setting the the `useGlobals` attribute to `true`:

```

  Here is your main content.

      Logged in as {USER_NAME} ({USER_ID}).

```

Specifying a required value
---------------------------

[](#specifying-a-required-value)

It is not only possible to check, whether a variable has a non-empty value, but also to check, whether you assigned a specific value to a variable. Take a look at the following template:

```

  Here is your main content.

      Admin-Options:
       - Delete page
       - Edit page

```

The template *admin-options* should only be displayed, if the currently logged in user is an admin. So we change the PHP code, to pass this information to the template globally:

```
$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput('my-template.tmpl');
if (userIsLoggedIn()) {
  $user = array(
             'ID'   => getUserId(),
             'NAME' => getUserName(),
             'TYPE' => getUserType()
          );
  $tmpl->addGlobalVars($user, 'USER_');
}
```

The `getUserType()` function should return either `admin` or `user` depending on the status of the currently logged in user. So it is not sufficient to only check, whether the `USER_TYPE` variable is set at all, but you need to check, whether it is set to `admin`. This can be easily accomplished:

```

  Here is your main content.

      Admin-Options:
       - Delete page
       - Edit page

```

This feature can be combined with the previously discussed feature that allowed you to specify more than one required variable.

The Condition Template
======================

[](#the-condition-template)

The *simpleCondition template* allows you to emulate a simple `if`-clause without the `else`-block. If that is not sufficient for your task, you may find the *condition template* helpful. It allows you to include full-fledged `switch/case`-blocks in your templates.

Predefined conditions
---------------------

[](#predefined-conditions)

Using variables as a condition
------------------------------

[](#using-variables-as-a-condition)

Adding comments to templates

If your templates get more complex, you might want to document what you are doing, so it is easier for other developers or designers to comprehend the template structure. Of course you could just add simple HTML-comments to the templates, but these would be sent to the browser when displaying the page, which would result in additional traffic, although the information is not needed by the client.

To avoid this, patTemplate provides the `` tag. All data inside this tag will be ignored when the page is displayed:

```

    You may place any content here, that documents the page template.

  Content of the template goes here...

```

When reading and displaying this template, the result will be:

```
Content of the template goes here...

```

Using the comment tag has another advantage. Although the data inside the comment tags will not be displayed, patTemplate will read and interpret it. When debugging your templates? with the dump() method, the comments will be displayed next to the templates, that contained them.

Using options
=============

[](#using-options)

patTemplate allows you to influence its behaviour by setting several of its options. To set an option, the `setOption` method can be used. It accepts two arguments:

1. The name of the option
2. The value of the option

Example:

```
$tmpl = new patTemplate();
$tmpl->setOption('allowFunctionsAsDefault', true);
```

Available options
-----------------

[](#available-options)

The following table shows all available options:

|| **Option** || **Description** || **Possible values** || || maintainBc || Whether patTemplate should maintain backwards compatibility to version 2.x. If set to `true` you may use *empty* and *default* in `` tags instead of *!\_\_empty* and *!\_\_default* || `true` or `false` || || defaultFunction || Name of the template function (i.e. user defined tag) that should be called if an unknown tag is encountered || any string || || allowFunctionsAsDefault || Whether it is allowed to specify a PHP function as a defaul value for variables. || `true` or `false` ||

Advanced features
=================

[](#advanced-features)

patTemplate offers a lot more than just replacing placeholders in an HTML template.

Here you will find tutorials on the more sophisticated features:

- \[wiki:Docs/Advanced/Modifiers Variable Modifiers\]
- \[wiki:Docs/Advanced/TemplateCache Improving performance with template caches\]
- \[wiki:Docs/Advanced/OutputFilters Output Filters\]
- \[wiki:Docs/Advanced/InputFilters Input Filters\]
- \[wiki:Docs/Advanced/External Including external templates\]

Reading templates from various data sources
===========================================

[](#reading-templates-from-various-data-sources)

patTemplate is not limited to reading templates from the file system, but uses a driver based approach to read templates from virtually anywhere.

This driver-based approach has two benefits:

1. Templates can be read from any data source
2. Different drivers may parse a different template format

A driver to read templates is called a *template reader*. Currently, the following \[source:trunk/patTemplate/Reader/ readers\] are available:

- *String*, reads templates from a string, can be used when your templates are created at runtime.
- *File*, reads templates from one or more files. This is the default reader.
- *DB*, reads templates from any database that is supported by \[ PEAR::DB\]
- *IT*, reads templates in the \[[http://pear.php.net/package/HTML\_Template\_IT](http://pear.php.net/package/HTML_Template_IT) HTML\_Template\_IT\] format from the filesystem

The reader to use can be specified when `parseTemplatesFromInput()` is called:

```
$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput('MyTemplates.tmpl', 'File');
```

If you want to use the file reader, the reader name is optional.

Reading templates from file
---------------------------

[](#reading-templates-from-file)

Reading templates from a file is the most common task. You may use the `setRoot()` method to specify one or more folders, where the templates are located.

```
$tmpl = new patTemplate();
$tmpl->setRoot('/path/to/templates', 'File');
$tmpl->readTemplatesFromInput('myTemplate.tmpl');
```

Reading templates from a string
-------------------------------

[](#reading-templates-from-a-string)

Reading a template from a string might be helpful, when you need to read a template from a source, that is not supported by patTemplate and implementing a new reader would be overkill.

All you need to do is pass the template source to the `readTemplatesFromInput()` method:

```
$string = 'This template has been parsed from a string ``, as well as this.';

$tmpl = new patTemplate();
$tmpl->readTemplatesFromInput( $string, 'String' );
```

Reading templates from a database
---------------------------------

[](#reading-templates-from-a-database)

When reading your templates from a database, the \[ PEAR::DB\] abstraction layer will be used. You need to pass the \[ DSN\] string to the `setRoot()` method:

```
tmpl = new patTemplate();
$tmpl->setRoot('mysql://root:@localhost/test', 'DB');
```

Imagine, your templates are stored in a table called *templates* that has to fields:

- `id`, unique id for a template
- `content`, a text field containing the actual template

If you want to read a template called *foo* from the database, you may use to different ways. One would be passing the SQL statement to the `readTemplatesFromInput()` method:

```
$tmpl->readTemplatesFromInput("SELECT content FROM templates WHERE id='foo'", 'DB');
```

However, if your table is that simple, you can let the reader build the query for you and use an XPath-like syntax:

```
$tmpl->readTemplatesFromInput('templates[@id=foo]/@content', 'DB');
```

This string consists of the following parts:

```
$table[@$keyName=$keyValue]/@$templateField
```

Reading HTML\_Template\_IT templates
------------------------------------

[](#reading-html_template_it-templates)

The *IT* reader allows you to read templates in the \[ HTML\_Template\_IT or PHPLib\] syntax. The reader itself works exactly like the *File* reader.

Using variable modifiers
========================

[](#using-variable-modifiers)

Variable modifiers allow the template designer to modify the values that have been passed from PHP before they will be displayed to the browser.

Imagine the following PHP script:

```
