5.3 Начало работы с Zend_View Placeholders. Стандартные Placeholder`ы | Participants
|
- Statistics
- Participants
- Translate into Russian
- Translation result
- 54% translated in draft.
If you do not want to register an account, you can sign in with OpenID.
Getting Started Zend_View Placeholders. Standard Placeholders | 5.3 Начало работы с Zend_View Placeholders. Стандартные Placeholder`ы | |
In the previous section, we learned about the placeholder() view helper, and how it can be used to aggregate custom content. In this section, we'll look at some of the concrete placeholders shipped with Zend Framework, and how you can use them to your advantage when creating complex composite layouts. | В предыдущем разделе мы узнали о помощнике вида placeholder(), и как он может использоваться для отображения (агрегирования) пользовательского содержимого. В этом разделе мы будем рассматривать некоторые из плэйсхолдеров (заполнителей) Zend Framework`а, и как вы сможете их использовать при создании сложных составных макетов (layouts). | |
Most of the shipped placeholders are for generating content for the <head> section of your layout content -- an area you typically cannot manipulate directly via your application view scripts, but one you may want to influence. As examples: you may want your title to contain certain content on every page, but specific content based on the controller and/or action; you may want to specify CSS files to load based on what section of the application you're in; you may need specific JavaScript scripts loaded at different times; or you may want to set the DocType declaration. | Большинство плэйсхолдеров используются для создания контента в секции <head> содержимого макета - области, которой вы обычно не может манипулировать напрямую через ваши скрипты приложения, но вы можете влиять на них. В качестве примера: У вас есть заголовок (title), который содержит некоторые содержание на каждой странице, но конкретное содержание, основанное на контроллере и/или действии; Вам может потребоваться задать CSS файлы для загрузки, основанные на каком разделе приложения; могут потребоваться определенные сценарии JavaScript, загруженных в разное время; или может потребоваться задать объявление DocType. | |
Zend Framework ships with placeholder implementations for each of these situations, and several more. | Zend Framework предоставляет реализации плэйсхолдеров для каждой из этих ситуаций и еще некоторые другие. | |
Setting the DocType | ||
DocType declarations are troublesome to memorize, and often essential to include in your document to ensure the browser properly renders your content. The doctype() view helper allows you to use simple string mnemonics to specify the desired DocType; additionally, other helpers will query the doctype() helper to ensure the output generated conforms with the requested DocType. | Объявления DocType трудны для запоминания, и его необходимо включить в документ для обеспечения правильного отображения браузером вашего контента. Помощник вида doctype() позволяет воспользоваться простой строкой мнемоники для указания желаемого типа DocType; кроме того другие помощники будет запрашивать doctype() помощник для обеспечения генерации вывода соответствующему запрашиваемому DocType-типу. | |
As an example, if you want to use the XHTML1 Strict DTD, you can simply specify: | Например если вы хотите использовать XHTML1 Strict DTD, можно просто указать: | |
01. $this->doctype('XHTML1_STRICT'); | ||
Among the other available mnemonics, you'll find these common types: | Среди других доступных мнемоник вы сможете найти следующие общие типы: | |
XHTML1_STRICT — XHTML 1.0 Strict | ||
XHTML1_TRANSITIONAL — XHTML 1.0 Transitional | ||
HTML4_STRICT — HTML 4.01 Strict | ||
HTML4_Loose — HTML 4.01 Loose | ||
HTML5 — HTML 5 | ||
You can assign the type and render the declaration in a single call: | Вы можете назначить тип и отображение декларации в одном вызове: | |
01. echo $this->doctype('XHTML1_STRICT'); | ||
However, the better approach is to assign the type in your bootstrap, and then render it in your layout. Try adding the following to your bootstrap class: | Однако лучше назначить тип в вашем классе начальной загрузки, и затем вывести его в макете. Попробуйте добавить следующее к классу начальной загрузки: |
