5.2 Начало работы с Zend_View Placeholders. Основы использования Placeholder`ов | Participants
|
- Statistics
- Participants
- Translate into Russian
- Translation result
- 99% translated in draft. Almost done, let's finish it!
If you do not want to register an account, you can sign in with OpenID.
Getting Started Zend_View Placeholders. Basic Placeholder Usage | 5.2 Начало работы с Zend_View Placeholders. Основы использования Placeholder`ов | |
Zend Framework defines a generic placeholder() view helper that you may use for as many custom placeholders you need. It also provides a variety of specific placeholder implementations for often-needed functionality, such as specifying the DocType declaration, document title, and more. | В Zend Framework`е определены общие помощники вида placeholder(), но которые так же можно использовать для множества пользовательских плэйсхолдеров. Он (плейсхолдер или заполнитель) также предусматривает ряд конкретных реализаций для часто необходимых функций, таких как указания декларации DOCTYPE, название документа, и многое другое. | |
All placeholders operate in roughly the same way. They are containers, and thus allow you to operate on them as collections. With them you can: | Все прототипы работают примерно одинаково. Они представляют собой контейнеры, и таким образом позволяют работать с ними, как с коллекцией. С их помощью вы можете: | |
• Append or prepend items to the collection. | ||
• Replace the entire collection with a single value. | ||
• Specify a string with which to prepend output of the collection when rendering. | • Указать строку с которой предварять вывод коллекции при рендеринге. | |
• Specify a string with which to append output of the collection when rendering. | • Указать строку которую добавлять в конец вывода коллекции при рендеринге. | |
• Specify a string with which to separate items of the collection when rendering. | • Указать стоку которой разделять элементы коллекции при рендеринге. | |
• Capture content into the collection. | ||
• Render the aggregated content. | ||
Typically, you will call the helper with no arguments, which will return a container on which you may operate. You will then either echo this container to render it, or call methods on it to configure or populate it. If the container is empty, rendering it will simply return an empty string; otherwise, the content will be aggregated according to the rules by which you configure it. | В основном вы будете вызывать помощник без параметров, что бы он вернул контейнер, с которым и будет происходить дальнейшая работа. Также можно вывести содержимое контейнера (добавив echo вначале), или же обращаться к методам контейнера, чтобы его сконфигурировать или заполнить данными. Если контейнер пустой - при рендеринге он просто вернет пустую строку; в противном случае содержимое будет соединяться по правилам, которые были определены для контейнера. | |
As an example, let's create a sidebar that consists of a number of "blocks" of content. You'll likely know up-front the structure of each block; let's assume for this example that it might look like this: | В качестве примера давайте создадим боковую панель (или сайдбар), которая состоит из нескольких блоков контента. Вы наверняка внешне знаете структуру каждого такого блока. Давайте предположим, что для этого примера она будет такой: | |
01. <div class="sidebar"> | ||
02. <div class="block"> | ||
03. <p> | ||
04. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus | 04. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus | |
05. consectetur aliquet odio ac consectetur. Nulla quis eleifend | 05. consectetur aliquet odio ac consectetur. Nulla quis eleifend | |
06. tortor. Pellentesque varius, odio quis bibendum consequat, diam | 06. tortor. Pellentesque varius, odio quis bibendum consequat, diam | |
07. lectus porttitor quam, et aliquet mauris orci eu augue. | 07. lectus porttitor quam, et aliquet mauris orci eu augue. | |
08. </p> | ||
09. </div> | ||
10. <div class="block"> | ||
11. <ul> | ||
12. <li><a href="/some/target">Link</a></li> |
