Add a custom region (region) Placement block in Drupal)

Source: Internet
Author: User
Tags php print drupal

The Block Function of Drupal can be embedded in HTML and PHP code. It is convenient and flexible to control display based on permission and URL matching. However, it is a habit to use the layout format of mediawiki, it is sometimes inconvenient to add a block under the title (the header block is at the top of the page by default ).

A few days ago, I knew that more blocks can be added in addition to the default block location of the garland topic in Drupal, but I have not tried it. I tried it today and it is very convenient to implement it, the following three steps are recorded:

Step 1: Modify the Template File

Modify the Page Template File page. TPL. php In the garland topic directory and insert the added variable:

<? PHP Print $ help;?>
<Div class = "Clear-block">
<? PHP Print $ top?> // Add the variable $ top above the content
<? PHP Print $ content?> // The original content variable $ content
<? PHP Print $ bottom?> // Add the variable $ bottom below the content
</Div>
<? PHP Print $ feed_icons?>

After the modification is saved, it does not take effect. You also need to modify the registration file:

Part 2: Modify the registration file

Modify the registration file garland.info In the garland topic directory and insert the new variable:

Regions [left] = left sidebar
Regions [right] = right sidebar
Regions [content] = content
Regions [header] = Header
Regions [footer] = footer
Regions [Top] = Top
Regions [bottom] = bottom

In addition to the two rows added at the bottom, note that the upper five rows contained by default are also written in; otherwise, the previous area blocks will disappear.

Part 3: refresh cache and start using

Then, you need to refresh the cache. The modified garland.info will take effect. After the refresh takes effect in the management menu, the newly added two regions can be displayed and placed in the same block as the previous five regions.

The above method can be used normally in Drupal 6. XX.

 

Http://jamesqi.com/%E5%8D%9A%E5% AE %A2/Drupal%E4%B8%AD%E6%B7%BB%E5%8A%A0%E8%87%AA%E5% AE %9A%E4%B9%89%E5%8C%BA%E5%9F%9F (region) % E6 % 94% be % E7 % BD % AE % E5 % 8C % Ba % E5 % 9d % 97 (Block)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.