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 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.
Example:
<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.
Example:
<insert name="show_block" module="site" id="1">
Outputs the contents of the block ID=1 of module "Site Pages".
Example:
<insert name="show_login" module="registration">
Outputs authorization form for website users.
Example:
<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()
.
Example:
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="значение"
).
Example:
<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
<
or
[
>
should be replaced by
>
or
]
&
should be replaced by
&
"
should be replaced by
"
or `Example:
<insert name="show_block" module="menu" id="3" tag_start_1="[li class="bottom"]" tag_start_2="[/li]">
Outputs menu ID=3, where each menu item will be issued in the design <li class="bottom">item menu</li>.