Skip to content

Instantly share code, notes, and snippets.

@wilburhimself
Created March 26, 2011 01:41
Show Gist options
  • Select an option

  • Save wilburhimself/887953 to your computer and use it in GitHub Desktop.

Select an option

Save wilburhimself/887953 to your computer and use it in GitHub Desktop.
Hook Preprocess Page Drupal 7
<?php
function phptemplate_preprocess_page(&$vars) {
if (module_exists('path')) {
$alias = drupal_get_path_alias(str_replace('/edit', '', $_GET['q']));
if ($alias != $_GET['q']) {
$template_filename = 'page';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '__' . $path_part;
$vars['theme_hook_suggestions'][] = $template_filename;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment