Skip to content

Instantly share code, notes, and snippets.

@steffenr
Created April 8, 2011 11:01
Show Gist options
  • Save steffenr/909642 to your computer and use it in GitHub Desktop.
Save steffenr/909642 to your computer and use it in GitHub Desktop.
HTTP_X_REQUESTED - new template file
<?php
function mytheme_preprocess_page(&$variables) {
// wurde die seite über AJAX request aufgerufen?
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ) {
$variables['template_files'] = is_array($variables['template_files']) ? $variables['template_files'] : array();
// füge ein neues template hinzu
$variables['template_files'][] = 'page-xhttp';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment