Template tags cause execution of functions or include files. Parsing the template files and the connection logic described in the file includes/parser_theme.php, class Parser_theme. The module object of this class is available through a variable $this->diafan->_parser_theme
. In common template tags (files from the folder themes/functions) object class is available through a variable $this
.
var current_module – текущий модуль, для котого вызвана шаблонная функция.
var is_tag – в текущий момент исполняется шаблонный тег.
void show_theme () – Подключает шаблон.
Example:
// connect the page template in the file includes/init.php
$this->_parser_theme->show_theme();
string get_function_in_theme (string $text, [boolean $php = false]) – Парсит шаблон.
Example:
$text = 'It displayed the news block: <insert name="show_block" module="news">';
echo $this->diafan->_parser_theme->get_function_in_theme($text);
/* Result:
It displayed the news block:
1 may
Beginning May holidays
2 may
Continuation of the May holidays
*/
void functions (string $name, [array $attributes = array()]) – Подключает файл, описывающий общий шаблонны тег.
Example:
// connect template tag <insert name="show_h1">
// in tag <insert name="show_body">
// file themes/functions/show_body.php
$this->functions('show_h1');
// connect template tag <insert name="show_year" year="2009">
$this->functions('show_year', array('year' => 2009));
array get_attributes (array $attributes) – Задает неопределенным атрибутам шаблонного тега значение по умолчанию.
Example:
// set the attributes for tag <insert name="show_href">
// file themes/functions/show_href.php
$attributes = $this->get_attributes($attributes, 'rewrite', 'img', 'img_act', 'width', 'height', 'alt');
Methods with the same name as their class will not be constructors in a future version of PHP; Markdown_Parser has a deprecated constructor #1 include_once() called at [/var/www/diafan/data/www/diafancms.com/modules/docs/docs.model.php:499] #2 Docs_model->prepare_text( Template tags cause execution of functions or include files. Parsing the template files and the connection logic described in the file *includes/parser_theme.php*, class *Parser_theme*. The module ob...) called at [/var/www/diafan/data/www/diafancms.com/modules/docs/docs.model.php:94] #3 Docs_model->show() called at [/var/www/diafan/data/www/diafancms.com/modules/docs/docs.php:29] #4 Docs->init() called at [/var/www/diafan/data/www/diafancms.com/includes/init.php:474] #5 Init->module() called at [/var/www/diafan/data/www/diafancms.com/includes/init.php:119] #6 Init->start() called at [/var/www/diafan/data/www/diafancms.com/index.php:62] | /var/www/diafan/data/www/diafancms.com/modules/docs/docs.model.php:499 |