Как работают шаблоны в MODx

Susan Ottwell, “How MODx Templates Work”, public translation into Russian from English More about this translation.

See also 104 similar translations

Translate into another language.

Participants

gorbarov2513 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 next untranslated
1 2 3 4 5 6 7 8 9

How MODx Templates Work

Как работают шаблоны в MODx

History of edits (Latest: gorbarov 2 years, 2 months ago) §

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 файла. Вы можете посмотреть исходный код любой страницы, скопировать и использовать его в качестве своего шаблона. (Вопрос нравственности не раскрыт. прим. пер.)
Вы можете создать шаблон используя любой HTML генератор, даже Word, если считаете, что действительно должны сделать это. Все что вам необходимо сделать - скопировать полученный HTML код, создать новый шаблон в панели управления и вставить в поле редактирования HTML код шаблона.

History of edits (Latest: gorbarov 2 years, 2 months ago) §

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.

History of edits (Latest: gorbarov 2 years, 2 months ago) §

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 кодом без подсветки то еще удовольствие.
Один из способов, как было сказано ранее - использовать визуальный редактор HTML, например, Dreamweaver, Rapidweaver, Bluefish и даже Word. Недостаток этого метода заключается в том, что вам придется копировать код шаблона после каждой правки обратно в форму его редактирования, а это плохо скажется на вашем душевном равновесии.

History of edits (Latest: gorbarov 2 years, 2 months ago) §

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 (или любой другой) файл. Этот способ будет подробно описан в статье про работу со сниппетами. В этом случае вы можете просто редактировать файл, как любой другой документ. Однако, этот способ возможно использовать только при разработке, т.к. это плохо скажется на производительности системы (прим. пер.).

History of edits (Latest: gorbarov 2 years, 2 months ago) §

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". Нажатие на кнопку откроет содержимое поля в вашем любимом редакторе, а после завершения работы - автоматически перенесет содержимое обратно в текстовое поле.
Плагин EditArea (http://modxcms.com/extras/package/514) позволит насладиться всеми плюсами подсветки синтаксиса, нумерации строк и другими приятными плюшками прямо в панели управления MODx.

History of edits (Latest: gorbarov 2 years, 2 months ago) §

A MODx Template Framework

MODx Template Framework

History of edits (Latest: gorbarov 2 years, 2 months ago) §

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 - наличие тегов. Этот фрагмент кода будут служить для всех страниц вашего сайта.

History of edits (Latest: gorbarov 2 years, 2 months ago) §
Pages: ← previous Ctrl next next untranslated
1 2 3 4 5 6 7 8 9