User Tools

Site Tools


ru:theme:advanced

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ru:theme:advanced [2013/09/25 13:10]
vladislav created
ru:theme:advanced [2013/10/17 09:53] (current)
Arkady [Страницы этой секции]
Line 1: Line 1:
-======Partial Template Files======+======Сборка шаблона из нескольких файлов и файл functions.php======
  
-It can be useful to break up page template files into partsespecially if you have several page templates and wish to use the same code in each of themPartial Template Files are given a .inc.php ​extension.+Иногда бывает удобно разбить шаблон страницы на несколько частейособенно если в вашей теме есть несколько шаблонов страниц,​ и вы не хотите использовать один и тот же код несколько разТаким файлам присваивается расширение ​.inc.php
  
 +===== Оптимальная организация файлов темы =====
  
-===== Optimal Theme Files Layout =====+В общем и целом, выбор оптимального варианта остается за разработчиком темы. В большинстве случаев,​ наилучшим вариантом было бы разбить файл ''​template.php'',​ например,​ на ''​header.inc.php''​ (шаблон для шапки страниц),​ ''​footer.inc.php''​ (шаблон для подвала страниц),​ ''​sidebar.inc.php''​ (шаблон для сайдбара страниц),​ и прописать в соответствующих местах файла ''​template.php''​ подключение частичных файлов командой ''​include()''​.
  
-The use of other files are completely up to the theme developer. Most of the time, it would be best to break the ''​template.php''​ file down into a couple other files such as ''​header.inc.php'',​ ''​footer.inc.php'',​ ''​sidebar.inc.php''​ and ''​style.css''​. These files can then be included into the ''​template.php''​ file. +Пример использования файла ​''​footer.inc.php'' ​в конце шаблона страницы
- +
-Example usage to include ​''​footer.inc.php''​, at the end of a template file:+
 <​code><?​php include('​footer.inc.php'​);​ ?></​code>​ <​code><?​php include('​footer.inc.php'​);​ ?></​code>​
  
-The file names listed above are completely arbitrarybut demonstrate a good semantic approach to laying out a themeIf you break out certain parts of the template ​you may reuse some code and it'll be easier to update it.+Имена файловприведенные в данной статье,​ не являются обязательными,​ но они преследуют семантический подход в формировании темыКроме того, если вы разумно разобьете свой шаблон на части, вы освободитесь от повторяющегося кода и облегчите себе задачу редактирования файлов темы в дальнейшей работе. 
 + 
 +**Начиная с версии 3.1**, ​ файлы, имеющие расширение ''​.inc.php'' ​ игнорируются при формировании выпадающего списка ​ шаблонов страниц. Например,​ пользователь не сможет ошибочно выбрать в качестве шаблона для страницы файл с именем ''​footer.inc.php'',​ файлы с таким расширением просто не берутся в список.  
 +====== Файл functions.php ​ ====== 
 +Разработчики имеют возможность включать в тему собственные PHP-функции,​ для размещения которых предназначен файл ''​functions.php''​ Этот файл должен располагаться в папке темы, там же, где и файл шаблона ''​template.php'' В ''​functions.php''​ могут содержаться практически любые пользовательские функции,​ написанные на PHP. Файл автоматически обрабатывается системой до загрузки темы. 
 + 
 +====== Ссылки ====== 
 + 
 +На главную [[ru:​|Содержание]]
  
-**As of 3.1**, you can force the page editor'​s "​Template"​ dropdown to ignore partial template files by naming them with a ''​.inc.php''​ extension. For example, a user will not be able to choose ''​footer.inc.php''​ as a page template because its file extension will prohibit it from ever showing in the select box.+===== Страницы этой секции =====
  
-====== ​Theme Functions File ======+=== Дополнительная информация по темам оформления ​=== 
 +  
 +  *[[ru:​admin_themes|Темы оформления для административной панели]]
  
-Developers also have the ability to include certain PHP functions within their theme by using the ''​functions.php''​ file. This will be placed in the same folder as the ''​template.php''​ file. The functions file can be used for just about anything to do with PHP as it is automatically included by GetSimple before the theme is loaded. 
  
ru/theme/advanced.1380114614.txt.gz · Last modified: 2013/09/25 13:10 by vladislav