>> Table of Contents >> Developer's Manual

New modifiers

Note: The following section describes additional modifiers, which are available to you in the Yana Framework and are not part of to the basic functionality of the Smarty template engine. The basic functions of the Smarty template engine are described in the documentation at http://smarty.net/docs.

css

[%$foo|css%]

Creates a link to a given path to a CSS-Datei.

Example:

[%"default.css"|css%]

Output:

<link rel="stylesheet" type="text/css" href="default.css">

date

[%$foo|date%]

From a variable containing an UTC, this modifier creates a JavaScript statement, that outputs the current time using the correct time zone of the client browser.

Example:
Template created: [%$CTIME|date%]<br>
Template modified: [%$MTIME|date%]<br>
Template last accessed: [%$ATIME|date%]<br>

Output:

Template created: 1/12/2006
Template modified: 19/1/2007
Template last accessed 21/1/2007

embeddedTags

[%$foo|embeddedTags%]

This modifier replaces all embedded tags in a variable by the appropriate tags, as prescribed by YANA's syntax.

Example:

$foo = "Text [b]Text[/b] Text"

Output:

Text <span style="font-weight: bold;">Text</span> Text

href

[%$foo|href%]

Generates a link to the file index.php including all required parameters. The string $foo is appended to the end of the URL The URL will automatically be embraced by double quotation marks (").

Example:

<a href=[%"action=myplugin_new_entry"|href%]>new entry</a>

Output:

<a href="index.php?sessid=foo&amp;id=example&amp;action=myplugin_new_entry">new entry</a>

smilies

[%$foo|smilies%]

Replaces all icon codes in a variable by the appropriate icons.

Example:

$foo = "Text :example: Text"

[%$foo|smilies%]

Output:

Text
<img border="0" hspace="2" src="common_files/smilies/example.gif">
Text

url

[%$foo|url%]

Generates a link, just as the modifier "href", but outputs an absolute path without quotation marks.

Example:

<meta http-equiv="Refresh" content="2; URL=[%"action=myplugin_new_entry"|url%]">

Output:

<meta http-equiv="Refresh" content="2;
URL=http://.../index.php?sessid=foo&amp;id=example&amp;action=myplugin_new_entry">

Attention!  The following will not work: <a href="[%"action=foo"|url%]">link</a>
Result: <a href="skins/default/http://.../index.php?...">link</a>

urlEncode

[%$foo|urlEncode%]

Encodes a text so that can safely be used as parameters in a URL. Therefore it will use the PHP function urlencode().

Example:

<a href="?bar1=foo1&amp;bar2=[%$foo|urlEncode%]">

Output:

<a href="?bar1=foo1&amp;bar2=foo%20bar">

Author: Thomas Meyer, www.yanaframework.net