F
F
Fuduin2014-03-20 14:04:08
Drupal
Fuduin, 2014-03-20 14:04:08

[Drupal] How to create a theme with custom regions?

Created a topic called second

name = Second
description = 123
core = 7.x

regions[myregion] = My Region

After logging into the admin panel in Administration->Appearance, there is a Drupal message next to my topic.
This version is not compatible with Drupal 7.x and should be replaced.

I deleted the line with the region, Drupal understood the topic and allowed me to change it.
Question 1: What caused the error if Drupal allows you to create your own regions?
After the theme was connected, I created the region again. Also created a page.tpl.php file .
<?php if ($page['myregion']): ?>
  <div id="myregion">
    <?php print render($page['myregion']); ?>
  </div>
<?php endif; ?>

The admin interface determined the region, I threw the authorization block into it, saved the changes. I logged out of the admin panel, cleared the cache, and re-entered the site. As a result, I see a white page with the inscription Welcome to drupal.test (drupal.test is my domain name). There is no hint of my div in the source code, but there is a header, footer and others.
Question 2: What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
F
Fuduin, 2014-03-21
@Fuduin

The second question was "resolved", if the hosting is located on an external machine, then this problem simply does not exist. If you use denver, then everything was decided by "deleting" the standard page.tpl.php.
The first question is still interesting.
PS: Although it would be more correct to clear the cache through the Drupal admin panel, and not in the browser. Then, probably, you can not touch the standard page.tpl.php.

P
Pavel, 2014-03-27
@pantey

In your case, the problem is that by creating your own region with your own name, you override all Drupal regions by default ... Therefore, if you create your own regions with custom names, then you must also define the basic Drupal regions, such as Content, Leftsiderbar etc.

V
Vasily Bratushka, 2014-05-06
@emigrant90

For new regions, it is better to use the Panels module - create regions directly from the admin panel without any conflicts

I
Ilya Petrovsky, 2014-05-27
@Mpa3b_ru21

for Drupal 7 it is critical to have the [content] region in the theme

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question