Creating a Completely Empty Page in Drupal

A project recently came to me where I was asked to embed some code within Drupal, however we were to keep none of the styling of the Drupal page. I created a custom module to do that. Here is the code I used in my .module file:


/**
* Implements hook_menu().
*/
function YOURMODULE_menu() {
$items = array();
$items['custom-url'] = array(
'page callback' => 'YOURMODULE_blank_page_callback',
'page arguments' => array(),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}


/**
* Display the content for your blank page.
*/
function YOURMODULE_blank_page_callback() {
include("myfile.php");
}

Make sure to replace the bold bits with the code pertinent to your project. I originally got some help from Stack Exchange.

 




Leave a Reply

Your email address will not be published. Required fields are marked *