This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
ru:theme:template_code_snippets [2013/09/13 10:09] vladislav [Примеры кода] |
ru:theme:template_code_snippets [2013/09/17 07:47] Arkady [Примеры кода] |
||
---|---|---|---|
Line 3: | Line 3: | ||
==returnPageContent()== | ==returnPageContent()== | ||
<code><?php returnPageContent(); ?></code> | <code><?php returnPageContent(); ?></code> | ||
- | Применяется с версии 3.1 this Caching/Indexing function can be used to check the page content (example: conditionals). | + | Применяется с версии 3.1 Эту кэш-функцию можноо использовать для проверки контента страницы (пример: проверка условий). |
==global $content;== | ==global $content;== | ||
<code><?php global $content; ?></code> | <code><?php global $content; ?></code> | ||
- | Применяется с версии 3.1 Similar to returnPageContent() this can be used to check the page content. | + | Применяется с версии 3.1 То же самое, что и returnPageContent(), используется для проверки контента страницы. |
- | ==output author== | + | ==значение поля author документа, страницы == |
<code><?php echo $data_index->author; ?></code> | <code><?php echo $data_index->author; ?></code> | ||
<code><?php getPageField(return_page_slug(),'author'); ?></code> | <code><?php getPageField(return_page_slug(),'author'); ?></code> | ||
Line 15: | Line 15: | ||
Последний пример служит для вывода Unicode-символов. | Последний пример служит для вывода Unicode-символов. | ||
- | ==conditional by template== | + | ==проверка условия по имени файла шаблона== |
<code><?php if ($template_file == 'name-of-template.php') { | <code><?php if ($template_file == 'name-of-template.php') { | ||
...</code> | ...</code> | ||
Line 21: | Line 21: | ||
<code>global $template_file;</code> | <code>global $template_file;</code> | ||
- | ==conditional by page (slug)== | + | ==проверка условия по постоянной ссылке(slug) страницы== |
<code><?php if (return_page_slug() == 'contact') { | <code><?php if (return_page_slug() == 'contact') { | ||
...</code> | ...</code> |