3

I need to create a page which is completely empty (no HTML returned at all). I need this for a POST callback (when using jEditable). I would like to still have access to the global variables (such as $user) and the modules that I have installed as I have a module installed which lets me access my REST service.

However, even though there should be not HTML returned per default, I should be able to return a string.

Does anyone know of a way to do this?

12

You can do that through a custom module - create a path and instead of returning the output, just print it.

Here's an example:

/**
 * 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() {
  print 'Your string.';
}

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.