Answer the question
In order to leave comments, you need to log in
Different node.tpl.php for different stuff types?
Good afternoon!
I'm running a website on CMS drupal 6, recently it became necessary to make my own node.tpl.php template file for certain types of material. Searching the Internet, I came across an article on how to actually solve this issue:
drupalfly.ru/lesson/type_node#comment-2125
But it did not work out according to the scheme described on the site. I sit and can not understand what exactly is wrong.
Tell me how to solve this issue?
Answer the question
In order to leave comments, you need to log in
You need to add your theme to template.php (copy-paste from my theme framework)
function framework_preprocess_page(&$vars) {
if (isset($vars['node'])) {
$vars['template_files'][] = 'page-'. str_replace('_', '-', $vars['node']->type);
}
if ($vars['node']->type != "") {
$vars['template_files'][] = "page-type-" . $vars['node']->type;
}
}
You need to have two files in your theme 1) node.tpl.php and 2) node-your_material_type.tpl.php. If the first file is missing, the system does not register the second one.
So I have the first file and made the second one, here:
That's just why nothing comes out, and the site's cache was cleared and the browser's cookies were cleared. Nothing helps. Because of what the system may not register the second file?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question