Prevent Drupal From Rendering Html.tpl.php for a custom page

Public

This snippet makes you able to prevent Drupal from rendering Html.tpl.php (in this example a view page). in my case I used it to replace a div via Ajax .

Get raw version
php
  1. <?php
  2. // Code By Reza.sh 1392/4
  3. // Removing Html.tpl.php code from http://drupal.stackexchange.com/questions/77896/dont-render-html-tpl-php-for-a-specific-path
  4. /**
  5.  * Implements hook_menu
  6.  */
  7. function removehtml_menu(){
  8. $items = array();
  9. $items['clean/view'] = array(
  10. 'page callback' => 'removehtml_clean_view',
  11. 'access arguments' => array('access content'),
  12. 'type' => MENU_CALLBACK,
  13. );
  14. return $items;
  15. }
  16.  
  17. /**
  18.  * Menu callback for your custom page
  19.  * Output view without wrapper page mark-up
  20.  */
  21. function removehtml_clean_view($name,$arg1,$arg2,$arg3,$arg4,$arg5){
  22. // Note views_embed_view performs views access check
  23. print views_embed_view($name,$display_id='page',$arg1,$arg2,$arg3,$arg4,$arg5);
  24. drupal_exit();
  25. }