I am creating a page.tpl.php template in Drupal 7 in which I want to rearrange how certain elements of the page are laid out. Specifically I want the title of the page to appear before the tabs and messages section (which I have done) and have the content of the page appear after the tabs and messages section (this is where I run into issues). I can't find a way to just render the $page['contents'] without the title. Is there a way to achieve this in Drupal 7?

I know that the node.tpl.php template handles the node specific layout, but it doesn't allow me to layout the page like as described above.


1 Answer 1


Somethings can be done in page.tpl.php & some in node.tpl.php

Like you said, you need to make title of the node appear before tabs. You can do this in your page.tpl.php. Find $title variable as well as $tabs & arrange accordingly in your page.tpl.php. Like --

<?php if ($title) : ?>
  <h1 class="title">
    <?php print $title; ?>
<?php endif; ?>
<?php if ($tabs): ?>
  <div class="tabs">
    <?php print render($tabs); ?>
<?php endif; ?>

After this you will have print render($page['content']);, where node.tpl.php comes into the scene, so arranging other things like node content, comment, links you will have to go to your node.tpl.php & arrange accordingly. More modification such as in comment & other TPLs will come into the scene like comment.tpl.php etc..

  • This is what I ended up doing in the end where I do not print out the node's title in the node.tpl.php file to achieve the effect I am looking for. As a caveat to others who want to achieve the same thing, you will need to use a node type specific templates so as to not hide article titles when multiple articles are listed on a page.
    – user5013
    Sep 16, 2013 at 21:22
  • You didn't specify the content type specific requirement, so I didn't mention anything of that regards in my answer. Anyway, node title is part of page.tpl.php not node.tpl.php..
    – RajeevK
    Sep 17, 2013 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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