/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<?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'];
$suggestion = 'page';
//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;
}
?>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                