I am trying to add HTML code outside the content area on every page load with the use of:

function us_page_build(&$page) {
  $page['content'][] = array(
    '#markup' => '<div class="fullscreen"><p>Here is my div content!!</p></div>',

However, in this way I am placing the element within the content attribute. Is there a way to set it outside, having as parent only the html element? I am aware I can paste code into the template files, but then if I switch to another template(which I will) I will need to re-enter it.

  • put it to page.tpl.php ?
    – Codium
    Feb 12, 2013 at 13:11
  • Thanks your the answer!Good idea, but in this way if I change theme I will need to re-insert it. I am trying to find a more generic way(sorry for not not being stated in the description above). Feb 12, 2013 at 13:15
  • Yes, but if all your themes are custom, you can use base theme
    – Codium
    Feb 12, 2013 at 13:21
  • Is there some reason a block won't work? Feb 12, 2013 at 13:27
  • well no I figured out that the it is not really critical to have the element outside the content, at least for my purposes. I guess placing it in a block would take it outside the content at least. Well the main idea is to have an element whose parents do not restrict it's width and height so it can grasp the whole screen. Feb 12, 2013 at 13:30

2 Answers 2


Content is a region in your theme. Site content goes into regions. So, typically you can only put things in defined regions such as Header, Footer, Left Sidebar, Content.

You have slight flexibility with #prefix and #suffix render array attributes. You either have to edit the html.tpl.php file, or define your own region within a theme. Or you can supply your own hook_theme() implementation to hint when using your own html.tpl.php template file.


You can also use the template_preprocess_page() in your module:

function modulename_preprocess_page(&$vars) {
  $vars['page_top'] .= '<div class="fullscreen"><p>Here is my div content!!</p></div>';

Or your could set $vars['closure'] for Drupal 6 or $vars['page_bottom'] for Drupal 7.

Your Answer

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

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