Template functions and tags

Template functions – this function to display all kinds of content to the user of the site. The template function is inseparable from the template tag, which is a tool to call a function in the site template when connecting to design DIAFAN.CMS.

Template tags

Template tags are used to run the template functions that display different content in the website template. Template tag is a tag type:

<insert [name=""] [module=""] [value=""] [attribute_1=""] [attribute_2=""]>

Use the template tags in the site template when connecting to design DIAFAN.CMS.

The tag includes a number of mandatory and optional attributes, dividing certain and uncertain attributes.

Specific attributes:

The template tag must be one of the attributes: name or value.


<insert name="show_body">

Displays the main content of the site: H1 headline, text, and the contents of the module when it is connected to the page.


<insert name="show_block" module="site" id="1">

Outputs the contents of the block ID=1 of module "Site Pages".


<insert name="show_login" module="registration">

Outputs authorization form for website users.


<insert name="show_block" module="menu" id="2" template="leftmenu">

Outputs menu ID=2. Design template – file modules/menu/views/menu.view.show_block_leftmenu.php

Template tag can also be accessed from the template modules. For this purpose it is necessary to process function htmleditor().


echo $this->htmleditor('<insert name="show_block" module="shop" sort="sale">');

When using the template modules/news/views/news.view.id.php displays on the page with a separate news three goods, the sales leaders.

All valid values of certain attributes name and module assembled in a template tag directory.

Some attribute value is used for automatic translation of texts in multilingual websites (value="значение").


<insert value="Hello, world!">

Outputs just the phrase "Hello, world!" In the main language versions of the site.

For other language versions of the translation can be specified in the administrative part of the site in the section language, or translate a word in the user part of the site using quick edit panel.

If the administrative part there is a translation for the phrase "Hello world!» - «Привет, мир!», in the user part of the site will display the same tag «Привет, мир!» when switching to the russion version.

Undefined attributes – all the other attributes that can be used in the template tag. They passed to the function as an array in the following format:

array(name => value, );

Values ​​of uncertain attributes depend on the module to which they belong. According sistaksisu value undefined attributes must be enclosed in quotation marks and must not contain symbols >, <, ", '. These characters should be replaced by HTML-mnemonics or special characters:

  • < should be replaced by &lt; or [
  • > should be replaced by &gt; or ]
  • & should be replaced by &amp;
  • " should be replaced by &quot; or `


<insert name="show_block" module="menu" id="3" tag_start_1="[li class=&quot;bottom&quot;]" tag_start_2="[/li]">

Outputs menu ID=3, where each menu item will be issued in the design <li class="bottom">item menu</li>.

Directory template tag