How to create an empty page (for Drupal) the easy way

This module creates a Void page. If you need a page to be populated only with blocks, you need the main content of this page to be empty. This is what this module does, as fast as possible. It performs much better than creating an empty module, for example.

As this empty page is usually required in front page, the title of the empty page is "Home". Edit lines 11 and 12 in void_page.module to change this. If you need to know more about this, check:

http://api.drupal.org/api/function/hook_menu/6

Besides that, if you need to hide the title in this page, seek for something like this in your theme:

<?php print $title ?>

...and replace it with something that checks if we are in the void page:

<?php if (arg(0) != 'void_page') print $title; ?>

More info on the included "readme" file.

AttachmentSize
void_page.zip1.54 KB

This actually quite good. Why isnt this in drupal.org? shouldnt you submit it?
Im using it right now.
thanx

Actually, I never considered this to be submitted to Drupal.org. I wrote this module at lightspeed for a rush job and as soon as I finished it I moved to next task.

Thank you for this module. How do I theme the new content area - embed view blocks using .tpl.php? I'd prefer not to create a new page--void_page.tpl because then I have to update the header, footer (whatever themeing I did) per page-....tpl. Is there a better way?

found the solution:

function void_page_menu() {
$items['void_page'] = array(
'title' => 'Void Page',
'page callback' => 'theme',
'page arguments' => array('sample_template'),
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}

function void_page_theme($existing, $type, $theme, $path) {
return array(
'sample_template' => array(
'template' => 'new_template',
),
);
}

Create new_template.tpl.php in the module folder. Haven't figured out how override it in theme template folder though.

Thanks for sharing this with us!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <i> <b> <strong> <cite> <pre> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <img> <h2> <h3> <blockquote>
  • Lines and paragraphs break automatically.

More information about formatting options