Документация InstantCMS

для администраторов и разработчиков

Инструменты пользователя

Инструменты сайта


en:dev:templates:scheme

Creating a Position Layout File

A position layout file is meant for placing widgets in the Control panel in a visual, user-friendly way. You should visualize all your template positions in it.

Introduction

This file is called scheme.html and is located in the root of the category tree of your template. Inside the file, HTML code is defined by means of HTML tables; however, you can design any layout at your discretion.

You can use a PHP code in this file, via $this all methods of the cmsTemplate class object are available. In particular, if your template has options, on which, for example, a sidebar location depends, you can design a position layout with regard to these options’ values.

Key Expressions

In this file, logic files are marked by key expressions. The expressions are wrapped in curly brackets and are separated by the colon ( : ) sign inside. The expression type is to the left of the colon, its value is to the right. Expression values may contain English alphabet letters, numbers, underscore signs and a hyphen. There are three types of expressions:

  • {position:POSITION_TITLE}
  • {block:LABEL}
  • {cell:LABEL}

Blocks, where widgets are dragged and dropped, are marked by the {position:POSITION_TITLE} expression. Think up the titles of positions beforehand, they should be identical both in this file and in the layout file of the template.

The {block:LABEL} and {cell:LABEL} blocks are, in fact, identical, though differ by their possible position in the layout. You can place {block:LABEL} next to the output of position blocks, whereas {cell:LABEL} is isolated from position blocks (they should not be at the top or bottom). The label is either a constant title, or some English text. These blocks are optional; they are designed to make the position layout of a template more visually user-friendly.

Example

<table>
    <tr>
        <td width="30%" class="filled">
            {cell:LANG_PAGE_LOGO}
        </td>
        <td>
            {position:header}
        </td>
    </tr>
</table>
<table>
    <tr>
        <td colspan="2">
            {position:top}
        </td>
    </tr>
    <tr>
        <?php if($this->options['aside_pos'] == 'left'){ ?>
            <td width="35%">
                {position:right-top}
                {position:right-center}
                {position:right-bottom}
            </td>
        <?php } ?>
        <td width="65%">
            {position:left-top}
            {block:LANG_PAGE_BODY}
            {position:left-bottom}
        </td>
        <?php if($this->options['aside_pos'] == 'right'){ ?>
            <td width="35%">
                {position:right-top}
                {position:right-center}
                {position:right-bottom}
            </td>
        <?php } ?>
    </tr>
</table>
<table>
    <tr>
        <td width="65%" class="filled">
            {cell:LANG_PAGE_FOOTER}
        </td>
        <td>
            {position:footer}
        </td>
    </tr>
</table>

Back to Section Contents

en/dev/templates/scheme.txt · Последнее изменение: 20.03.2017 00:50 — murlysja