4

I have a page within Drupal administration where I want to bypass all of the normal Drupal theming and calculations to only show the HTML that's returned by the function. Is this possible?

 $items['admin/special_blank_page'] = array(
    'title' => 'PDF',
    'page callback' => 'special_blank_page',
    'type' => MENU_LOCAL_TASK,
  );

//...

  function special_blank_page(){
      $html ='<html><head></head><body>Only show this HTML</body></html>';
      return $html;     
  }
7

Just to offer an alternative to Ayesh K's solution, you can set the delivery callback of your menu item

The function to call to package the result of the page callback function and send it to the browser. Defaults to drupal_deliver_html_page() unless a value is inherited from a parent menu item. Note that this function is called even if the access checks fail, so any custom delivery callback function should take that into account. See drupal_deliver_html_page() for an example.

1

Yes, if you print the output instead of returning it.

function special_blank_page(){
      $html ='<html><head></head><body>Only show this HTML</body></html>';
      print $html;     
  }

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.