How to change the template when we show a node using view

we have placed a view for show details of each node in drupal 6 with a path of the view as ‘node/%’.But web site contains a system of multiple blogs using advanced_blog and custom module for manage some extra functionality for blog pages according to the blog html template.i prefer to add a template for blog and named it as page-blog.tpl.php.and all path of the blog is aliased with ‘blog/’.Every thing is working fine until when i click link to view the detials of a blog entry.It fallbacks to default page.tpl.php for showing the details.But i want to remain on the page-blog page.So i used the follwing script with ‘path’ module
//put this script in template.php if exist preprocess_page then only //insert contents of function:
function phptemplate_preprocess_page(&$vars) {
if ($vars[‘is_front’] != 1) {
$vars[‘template_files’][] = ‘page-‘ . $vars[‘node’]->type;
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[‘template_files’][] = $template_filename;
}
}
}
}
}

this function creates all possible combinations of templates suggestions to drupal.And in that page i use module_invoke for getting the results

Advertisements