Page templates and sections
A page has two templates: a layout — the frame around the content: header, menu, footer — and a content template — what is on the page. Both are XML files. A page can also keep its own XML, which overrides the file.
Choosing the templates of a page
The page form in «Управление структурой» (Structure management) has two lists: «Содержимое страницы» (Page content) and «Макет страницы» (Page layout). They show every content and layout template linked into web/templates/. A template's name in the list is the translation of the interface string CONTENT_<FILE NAME> or LAYOUT_<FILE NAME>.
A page with its own XML shows it in the form as a code field with «Вернуть к начальному виду» (Reset to original); choosing another content template drops the page's own XML when the page is saved.
Templates for visitors
| Template | File | What is on the page |
|---|---|---|
| «Лендинг» (Landing) | main/landing.content.xml |
first screen, services, reviews, call to action, contacts |
| «Услуга» (Service) | main/service.content.xml |
first screen, the page's own text, prices, questions and answers, call to action |
| «Контакты» (Contacts) | main/contacts.content.xml |
the page's title and text, contacts |
| «Текстовая страница» (Text page) | textblock.content.xml |
the page's title and text |
| «Главная страница» (Home page) | main.content.xml |
a text and a side column with a text shared by all pages; the installed home page uses it |
| «Список подразделов» (Subsection list) | childs.content.xml |
a text and the list of the page's subpages |
| «Карта сайта» (Site map) | map.content.xml |
the tree of the site's pages |
Sign-in, registration, password recovery, the profile and the admin pages have templates of their own; the installer gives them to the right pages. The site's templates live in site/modules/main/templates/content/ and are listed as main/<name>.content.xml; the core's are in core/modules/*/templates/.
The layouts: «Базовый» (Basic) — the main menu, the sign-in link, the language switcher, the footer text and, for administrators, the admin toolbar; «Пустой» (Empty) — no frame.
Sections
A section is a part of a page with its own text and its own look; the owner edits its text on the page. In a template a section is a container with the attribute section and a text block inside:
<container name="cta" section="cta">
<component name="section_cta" class="TextBlock">
<params><param name="section">cta</param></params>
</component>
</container>
class is the short name of a component: it is looked up in the site's modules, then in the core's; a full class name works too. section sets the number of the text block and the section's sample text. The numbers are fixed in the code, and the texts are stored in the database under them:
| Section | Number | The owner's text | Look |
|---|---|---|---|
hero |
11 | h1, a paragraph, a link, a picture (optional) |
the picture becomes a darkened background, the link a button |
services |
12 | h2, a list: strong and a description in each item |
the items become cards in a grid |
prices |
13 | h2, a list of plans: h3, the price as a paragraph, a nested list, a link |
plans in columns, the link a button |
reviews |
14 | h2, blockquote quotes with p and cite |
quotes as cards |
gallery |
15 | h2, pictures |
a 4:3 grid of pictures |
faq |
16 | h2, pairs of h3 and a paragraph, or details |
questions with separators |
contacts |
17 | h2, paragraphs with the address, tel:, mailto: and map links |
columns on wide screens |
cta |
18 | h2, a link |
a strip in the accent colour, the link a button |
On the site a section is a full-width <section> whose id is the section's name, so #contacts links to it. An empty section is not shown on the site — to visitors and administrators alike; in edit mode it shows a sample text from the interface string TXT_SECTION_SAMPLE_<NAME>, ready to be replaced.
There are no feedback forms and no page attachments: contacts are links, and a gallery is pictures in the text.
A template of your own
php index.php setup page --name=about --title="О компании" --sections=hero,services,reviews,cta
--name— lowercase Latin letters, digits and_, starting with a letter; it becomes the file nameabout.content.xml.--title— the template's name in the list in Russian;--title-ua— in Ukrainian (the Russian one if omitted).--sections— a comma-separated list of the eight section names above.
The command writes site/modules/main/templates/content/<name>.content.xml with a container per section, adds CONTENT_<NAME> to site/modules/main/translations.php, loads it into the database and runs setup linker. It refuses to overwrite an existing file or string.
By hand: put the XML into site/modules/main/templates/content/, add CONTENT_<NAME> to site/modules/main/translations.php, then run php index.php setup translations and php index.php setup linker.
Components and their configs
The site's own components go to site/modules/main/components/ (namespace EnergineSite\main\components), their configs to site/modules/main/config/. A config can keep only its differences from another one: <configuration extends="DivisionEditor.component.xml"> takes the states of the base config, a state with the same name replaces the base one in place, a new one is added at the end, and <state name="…" remove="1"/> removes a state.