I
I
Ivan Semenov2014-11-10 12:16:13
Drupal
Ivan Semenov, 2014-11-10 12:16:13

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

3 answer(s)
T
Timur Malikin, 2014-11-11
@kokman_semenov

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;
    }
}

Clear the cache, and then you can add files like page-type-news.tpl.php

A
Andrey Mikhailov, 2014-11-10
@RainBowAM

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.

I
Ivan Semenov, 2014-11-10
@kokman_semenov

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 question

Ask a Question

731 491 924 answers to any question