/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Drupal 5 <?php switch ($hook) { case 'page': // Add page template suggestions based on the aliased path. // For instance, if the current page has an alias of about/history/early, // we'll have templates of: // page-about-history-early.tpl.php // page-about-history.tpl.php // page-about.tpl.php // Whichever is found first is the one that will be used. if (module_exists('path')) { if ( $alias != $_GET['q'] && $alias == $_REQUEST['q'] ) { $template_filename = 'page'; $template_filename = $template_filename . '-' . $path_part; $suggestions[] = $template_filename; } } $vars['template_files'] = $suggestions; } break; } return $vars; } ?> //Drupal 6 <?php function phptemplate_preprocess_page(&$vars) { if (module_exists('path')) { if ($alias != $_GET['q']) { $template_filename = 'page'; $template_filename = $template_filename . '-' . $path_part; $vars['template_files'][] = $template_filename; } } } } ?>
URL: http://drupal.org/node/139766