Project

General

Profile

How to add new block positions

Below you will find instructions on how to create new positions for blocks.
In case you want to put a block into some not listed position, this article will be helpful.
In this article we will be using Skeleton template as an example. Suppose we need a new block position for advertisement right after main content. Lets call it afterMainContent.

Adding position

INSTRUCTION FOR 3.3.x and 4.0.x VERSIONS:

1. In Admin Panel, use quick links to open MySQL Tools:


2. Open positions table ([prefix]_positions). Click "New item". You will see the result like it is shown at the picture below:

add-position_mysql-tools_positions-table


3. Add afterMainContent to the name and click Save:

add-position_mysql-tools_new-position-3.3


4. Now we need to place this new position to layout so it will be visible. Open up Skeletons' layout.tpl ([subrion_folder]/templates/skeleton/)_ file and place this code right after main content:

...
<h1 class="page-header">{$core.page.title}</h1>

{ia_hooker name='smartyFrontBeforeNotifications'}
{include file='notification.tpl'}

{ia_hooker name='smartyFrontBeforeMainContent'}

{$_content_}

{ia_blocks block='afterMainContent'}

{ia_hooker name='smartyFrontAfterMainContent'}

{ia_blocks block='bottom'}

{if isset($iaBlocks.user1) || isset($iaBlocks.user2)}
    <div class="row">
        <div class="{width section='user-blocks' position='user1'}">{ia_blocks block='user1'}</div>
        <div class="{width section='user-blocks' position='user2'}">{ia_blocks block='user2'}</div>
    </div>
{/if}
...

After this step, in Admin Panel hit Clear Cache quick link.


5. We are ready to create new block in our new position. In Admin Panel on Dashboard page hit Edit Blocks quick link and then hit Add new block. On this page, fill necessary fields and choose our new position.

That's it!


INSTRUCTION FOR 3.2.x VERSIONS:

1. In Admin Panel, use quick links to open MySQL Tools:


2. Open config table ([prefix]_config). Click "Select data" and then click over "Search" block to expand it. Instead of "(anywhere)" choose "name", and input "block_positions" into the empty field. Click "Select" button. You will see the result like it is shown at the picture below:


3. Click the pencil icon next to the found record and add afterMainContent to the value and click Save:


4. Now we need to place this new position to layout so it will be visible. Open up Skeletons' layout.tpl ([subrion_folder]/templates/skeleton/)_ file and place this code right after main content:

...
<h1 class="page-header">{$pageTitle}</h1>

{ia_hooker name='smartyFrontBeforeNotifications'}
{include file='notification.tpl'}

{ia_hooker name='smartyFrontBeforeMainContent'}

{$_content_}

{ia_hooker name='smartyFrontAfterMainContent'}

{ia_blocks block='afterMainContent'}

{ia_blocks block='bottom'}

{if isset($iaBlocks.user1) || isset($iaBlocks.user2)}
  <div class="row">
    <div class="{width section='user-blocks' position='user1' movable=true}">{ia_blocks block='user1'}</div>
    <div class="{width section='user-blocks' position='user2' movable=true}">{ia_blocks block='user2'}</div>
  </div>
{/if}
...

After this step, in Admin Panel hit Clear Cache quick link.


5. We are ready to create new block in our new position. In Admin Panel on Dashboard page hit Edit Blocks quick link and then hit Add new block. On this page, fill necessary fields and choose our new position.
And you are done!