1

Do you know what to write to the page.tpl.php file so that it shows only 5 regions (header, menu, left_sidebar, content, right_sidebar)? Something like the following code, but to work correctly with other Drupal files and components (like *.info file) and don't collide with Drupal default regions.

<body>
  <div id="header"><?php print $page['header']; ?></div>
  <div id="menu"><?php print $page['menu']; ?></div>
  <div id="left"><?php print $page['left']; ?></div>
  <div id="content"><?php print $page['content']; ?></div>
  <div id="right"><?php print $page['right']; ?></div>
</body>
0

You want to use render() like this:

 <?php print render($page['content']); ?>

I'm not really sure what you mean by "but to work correctly with other Drupal files and components."

You should also print all the standard regions and any other variables you might need. You can find a list of the default variables available to page.tpl.php in the documentation page.

Also here's a list of the regions you probably should include:

  • $page['help']: Dynamic help text, mostly for admin pages.
  • $page['highlighted']: Items for the highlighted content region.
  • $page['content']: The main content of the current page.
  • $page['sidebar_first']: Items for the first sidebar.
  • $page['sidebar_second']: Items for the second sidebar.
  • $page['header']: Items for the header region.
  • $page['footer']: Items for the footer region.
7
  • OK, I repaired it according to your advice. In firebug I can see my regions, but they are empty (e.g. <div id="left"></div> or <div id="right">Array</div>). In Structure -> Blocks I assigned to the regions some blocks (RSS, login) but they aren't rendered.
    – xralf
    Apr 13 '11 at 18:38
  • You need to use print render() for every variable.
    – ericduran
    Apr 13 '11 at 18:43
  • I used print render(). It corrected it as follows : <div id="right"></div>. But I have a navigation and login in left region and RSS in right region and it's still empty.
    – xralf
    Apr 13 '11 at 18:55
  • Are you using $page['sidebar_first'] and $page['sidebar_second']? in drupal-7 there is no longer $left and $right variables.
    – ericduran
    Apr 13 '11 at 22:11
  • I'm using <div id="left"><?php print render($page['sidebar_first']); ?></div> and <div id="right"><?php print render($page['sidebar_second']); ?></div> In tmp.info there are lines regions[sidebar_first] = "Left region" and regions[sidebar_second] = "Right region"
    – xralf
    Apr 14 '11 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.