Revision: 3577
Updated Code
at August 15, 2007 08:12 by eethann
Updated Code
<?php
function _phptemplate_variables($hook, $vars) {
switch ($hook) {
case 'page':
// this is a hack to suggest template files based on request uri
// to suplement standard arg-based suggestions. this allows for
// aliases to be taken into account
$request_uri = $_SERVER['REQUEST_URI'];
$request_uri = str_replace('my_statement','application',$request_uri);
$suggestion = 'page';
$suggestions = array();
$matches = explode('/',$request_uri);
$num_matches = count($matches);
//ignore the first match, since the URI is of the form /path/to/uri
for ($i=1;$i<$num_matches;$i++) {
$suggestion .= '-'. $matches[$i];
$suggestions[] = $suggestion;
}
$vars['template_files'] = $suggestions; // array($section_template);
break;
// any additional code here
}
return $vars;
}
?>
Revision: 3576
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 15, 2007 08:11 by eethann
Initial Code
Initial URL
Initial Description
Initial Title
phptemplae page template based on uri
Initial Tags
php, textmate, drupal
Initial Language
PHP