Как работают шаблоны в MODx | Participants
|
- Statistics
- Participants
- Translate into Russian
- Translation result
- 95% translated in draft. Almost done, let's finish it!
If you do not want to register an account, you can sign in with OpenID.
How MODx Templates Work | ||
A MODx template can be created from any static HTML page. You can view the source of any web page, copy the HTML, and use it for your template. You can create the template using any HTML generator, even Word if you really feel you must. All you need to do is copy the generated HTML code, open a new template editor in the Manager, and paste the code in the field. | Шаблон MODx может быть создан из любого HTML файла. Вы можете посмотреть исходный код любой страницы, скопировать и использовать его в качестве своего шаблона. (Вопрос нравственности не раскрыт. прим. пер.) | |
Just like a static HTML page, the template will need a doctype, a head and a body. Ideally, the template should only contain the HTML structure, all text and dynamic content is represented by the appropriate MODx templating tags. | В шаблоне, как и в любой html странице, должны быть основные html теги (doctype, head, body). В идеале шаблон должен содержать только HTML структуру, все содержимое и динамический контент будет представлен специальными тегами MODx. | |
The template editing field is just a plain textarea. There are a few options if you don't feel comfortable working with HTML in plain text like that. One, as was mentioned before, is to use an HTML generator such as Dreamweaver, Rapidweaver, Bluefish or even Word. The disadvantage of this is that you need to copy/paste your changes into the form in the MODx Manager, which can slow your development as well as break your concentration. | Поле редактирования шаблона по-умолчанию просто textarea. Есть несколько способов здорово упростить себе жизнь, ведь работать с HTML кодом без подсветки то еще удовольствие. | |
Another method is to use a snippet to include an external .html or other text file. This will be covered in more detail in the article on snippets. In this case, you can simply edit the text file as you would any other static HTML document. | Другой способ заключается использовании сниппета, подключающего внешний .html (или любой другой) файл. Этот способ будет подробно описан в статье про работу со сниппетами. В этом случае вы можете просто редактировать файл, как любой другой документ. Однако, этот способ возможно использовать только при разработке, т.к. это плохо скажется на производительности системы (прим. пер.). | |
Yet a third option is to use Firefox and install the It's All Text! extension. Right-click on the textarea and select your editor; this extension also adds a little "edit" button to a textarea field when you put the mouse pointer in it. It will open your preferred text editor with the content of the textarea. When you save your work in the text editor, it is automatically pasted into the textarea. This way you get the advantage of line numbers, syntax highlighting, and any other features you use a text editor for in the first place, without any effect whatsoever on how MODx stores and uses the template. | Есть еще и пара других способов, например установить Firefox и использовать расширение "It's All Text!", добавляющее ко всем textarea кнопку "edit". Нажатие на кнопку откроет содержимое поля в вашем любимом редакторе, а после завершения работы - автоматически перенесет содержимое обратно в текстовое поле. | |
A MODx Template Framework | ||
Let's look at a basic three-column source-ordered template the MODx way. As you can see, this is almost entirely a plain old HTML document. Some of the values are generated dynamically by using MODx tags. All content is inserted with tags. This is what makes it a template; this one bit of HTML code will serve for all the pages on your site. | Давайте посмотрим на обычный трехколоночный макет глазами MODx. Как вы видите это практически обычный, старый добрый, html файл. На месте специальных тегов MODx будет подставлен динамический контент. Вот что делает шаблон шаблоном в понимании MODx - наличие тегов. Этот фрагмент кода будут служить для всех страниц вашего сайта. |
