Как работают TV-переменные в MODx | Participants
|
- Statistics
- Participants
- Translate into Russian
- Translation result
- 18% translated in draft.
If you do not want to register an account, you can sign in with OpenID.
How MODx Template Variables Work | ||
How MODx Template Variables Work | ||
Template Variables are one of the most powerful features of MODx dynamic content generation. At their simplest, they can be considered extensions to the existing document variables, such as pagetitle, longtitle and content. Custom fields, as it were. But they can go far beyond that, querying the database or processing PHP code. | TV-переменные — это одна из мощнейших преbмуществ MODx-овой динамической генерации контента. Проще говоря, вы можете получать любые переменные существующих документов, такие как pagetitle (заголовок страницы), longtitle (расширенный заголовок), content (содержимое страницы). Также пользовательские поля, они могут пойти гораздо дальше, включая SQL-запросы к БД и PHP-код | |
TVs are extra tables in the database, with a selection of various types of extra fields added to the document editing form as TVs are created. They also have a choice of output formatting "widgets" to control the appearance of their output in the final web page. | TV — это специальные таблицы в БД с выбором типа содержимого специальных полей, добавленных при редактировании документа. Они также имеют «виджеты» для изменения внешнего вида выдачи в конечной веб-странице. | |
TVs are connected to templates (hence the name Template Variable). Any document that is assigned the same template will have the TV's extra fields in the Template Variables section below the main Document content editing area. Access to a TV can be controlled by the same security measures used to control access to documents, which will be covered in detail in a later chapter. | TV подключены к шаблонам (отсюда и название — «переменные шаблона»). Любой документ, имеющий одинаковый шаблон, будет иметь TV-дополнительные поля в секции TV ниже поля для редактирования основного содержимого документа. Доступ к TV может настроен с помощью тех же средств, что используются для доступа к документам, которые будут рассмотрены позже. | |
The order in which a template's TV fields will appear in the document editing form is managed by a drag-and-drop interface in the Templates tab of the Resources -> Manage Resources main menu item. When you select a template to edit, you will see the Assigned Template Variables tab. Opening that tab will show a list of the TVs assigned to that template. If you have more than one TV assigned to the template, you'll see a link "Edit the sort order of the template variables". This will open another page with the TVs listed in boxes. You can drag-and-drop the TVs into the order you want. This is on a template-wide basis; you cannot have the order different for different documents using the same template. | ||
TVs are managed by three .php files in the manager/includes directory. These contain functions that are called by the parser when processing TVs. | Управление TV происходит в трех php-файлах в менеджере/включенных папках. Они содержат функции, которые вызваны парсером, обрабатывающим TV-параметры. | |
tmplvars.inc.php - controls the field type for adding to the document editing form. | tmplvars.inc.php — контролирует тип поля добавляемого к форме редактирования документа. | |
tmplvars.command.inc.php - processes bindings and returns their value. | tmplvars.command.inc.php — обрабатывает @-привязки и возвращает их значения |
