1.3 Zend Framework — Быстрый старт. Создание макета

Zend, “Zend Framework Quick Start. Create A Layout”, public translation into Russian from English More about this translation.

See also 44 similar translations

Translate into another language.

Participants

antdmi 802 points
victor-gryshko 63 points
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: previous Ctrl next
1 2 3 4

    01. ; application/configs/application.ini

01. ; application/configs/application.ini

History of edits (Latest: antdmi 7 years, 6 months ago) §

    02.

02.

History of edits (Latest: antdmi 7 years, 6 months ago) §

    03. [production]

03. [production]

History of edits (Latest: antdmi 7 years, 6 months ago) §

    04. ; PHP settings we want to initialize

04. ; PHP settings we want to initialize

History of edits (Latest: antdmi 7 years, 6 months ago) §

    05. phpSettings.display_startup_errors = 0

05. phpSettings.display_startup_errors = 0

History of edits (Latest: antdmi 7 years, 6 months ago) §

    06. phpSettings.display_errors = 0

06. phpSettings.display_errors = 0

History of edits (Latest: antdmi 7 years, 6 months ago) §

    07. includePaths.library = APPLICATION_PATH "/../library"

07. includePaths.library = APPLICATION_PATH "/../library"

History of edits (Latest: antdmi 7 years, 6 months ago) §

    08. bootstrap.path = APPLICATION_PATH "/Bootstrap.php"

08. bootstrap.path = APPLICATION_PATH "/Bootstrap.php"

History of edits (Latest: antdmi 7 years, 6 months ago) §

    09. bootstrap.class = "Bootstrap"

09. bootstrap.class = "Bootstrap"

History of edits (Latest: antdmi 7 years, 6 months ago) §

    10. appnamespace = "Application"

10. appnamespace = "Application"

History of edits (Latest: antdmi 7 years, 6 months ago) §

    11. resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

11. resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

History of edits (Latest: antdmi 7 years, 6 months ago) §

    12. resources.frontController.params.displayExceptions = 0

12. resources.frontController.params.displayExceptions = 0

History of edits (Latest: antdmi 7 years, 6 months ago) §

    13. resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"

13. resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"

History of edits (Latest: antdmi 7 years, 6 months ago) §

    14.

14.

History of edits (Latest: antdmi 7 years, 6 months ago) §

    15. [staging : production]

15. [staging : production]

History of edits (Latest: antdmi 7 years, 6 months ago) §

    16.

16.

History of edits (Latest: antdmi 7 years, 6 months ago) §

    17. [testing : production]

17. [testing : production]

History of edits (Latest: antdmi 7 years, 6 months ago) §

    18. phpSettings.display_startup_errors = 1

18. phpSettings.display_startup_errors = 1

History of edits (Latest: antdmi 7 years, 6 months ago) §

    19. phpSettings.display_errors = 1

19. phpSettings.display_errors = 1

History of edits (Latest: antdmi 7 years, 6 months ago) §

    20.

20.

History of edits (Latest: antdmi 7 years, 6 months ago) §

    21. [development : production]

21. [development : production]

History of edits (Latest: antdmi 7 years, 6 months ago) §

    22. phpSettings.display_startup_errors = 1

22. phpSettings.display_startup_errors = 1

History of edits (Latest: antdmi 7 years, 6 months ago) §

    23. phpSettings.display_errors = 1

23. phpSettings.display_errors = 1

History of edits (Latest: antdmi 7 years, 6 months ago) §

This directive tells your application to look for layout view scripts in application/layouts/scripts. If you examine your directory tree, you'll see that this directory has been created for you now, with the file layout.phtml.

Эта инструкция указывает приложению что бы оно скрипты для макета вида искал в application/layouts/scripts. Если посмотрите этот каталог, то увидите, что этот каталог сейчас существует и содержит файл layout.phtml.

History of edits (Latest: antdmi 7 years, 9 months ago) §

We also want to ensure we have an XHTML DocType declaration for our application. To enable this, we need to add a resource to our bootstrap.

Нам так же неоходимо обеспечить, что для нашего приложения используеться объявление XHTML DocType. Для этого, мы должны добавить ресурс в наш загрузчик (bootstrap).

History of edits (Latest: antdmi 7 years, 9 months ago) §

The simplest way to add a bootstrap resource is to simply create a protected method beginning with the phrase _init. In this case, we want to initialize the doctype, so we'll create an _initDoctype() method within our bootstrap class:

Простейший путь добавить ресурс загрузчика это просто создать защищенный (protected) метод начинающийся с фразы _init. В таком случае, необходимо инициализировать doctype, следовательно мы создадим метод _initDoctype() внутри нашего класса загрузчика:

History of edits (Latest: antdmi 7 years, 9 months ago) §

    01. // application/Bootstrap.php

01. // application/Bootstrap.php

History of edits (Latest: antdmi 7 years, 6 months ago) §

    02.

02.

History of edits (Latest: antdmi 7 years, 6 months ago) §

    03. class Bootstrap extends Zend_Application_Bootstrap_Bootstrap

03. class Bootstrap extends Zend_Application_Bootstrap_Bootstrap

History of edits (Latest: antdmi 7 years, 6 months ago) §

    04. {

04. {

History of edits (Latest: antdmi 7 years, 6 months ago) §

    05.     protected function _initDoctype()

05. protected function _initDoctype()

History of edits (Latest: antdmi 7 years, 6 months ago) §

    06.     {

06. {

History of edits (Latest: antdmi 7 years, 6 months ago) §

    07.     }

07. }

History of edits (Latest: antdmi 7 years, 6 months ago) §

    08. }

08. }

History of edits (Latest: antdmi 7 years, 6 months ago) §

Within that method, we need to hint to the view to use the appropriate doctype. But where will the view object come from? The easy solution is to initialize the View resource; once we have, we can pull the view object from the bootstrap and use it.

Внутри этого метода, мы должны подсказать виду (view) какой doctype использовать. Но где объекту вида (view object) взяться? Удобное решение, это инициализировать ресурс вида (View resource); как только мы будем иметь ресурс, мы может извлечь объект вида из загрузчика и использовать его.

History of edits (Latest: antdmi 7 years, 9 months ago) §

To initialize the view resource, add the following line to your application/configs/application.ini file, in the section marked production:

Для инициализации ресурса вида, добавим следующие строки в файл application/configs/application.ini, в секцию production:

History of edits (Latest: antdmi 7 years, 9 months ago) §
Pages: previous Ctrl next
1 2 3 4