Темизация нод по NID, а не по [content-type]
По дефолту в друпале 6 можно темизировать темплейт ноды по типу материала (content-type), например - node-video.tpl.php. А что делать если нам необходимо "затемить" только одну ноду индивидуально? Для этого открываем наш template.php файл и вносим в него следующие изменения:
/**
* Override or insert variables into the node templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("node" in this case.)
*/
// Replace 'THEME' with your theme's name or 'phptemplate'
function THEME_preprocess_node(&$vars, $hook) {
$node = $vars['node'];
$vars['template_file'] = 'node-'. $node->nid;
}
* Override or insert variables into the node templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("node" in this case.)
*/
// Replace 'THEME' with your theme's name or 'phptemplate'
function THEME_preprocess_node(&$vars, $hook) {
$node = $vars['node'];
$vars['template_file'] = 'node-'. $node->nid;
}
Затем не забудьте очистить кеш. Теперь вы можете создавать шаблоны типа node-16.tpl.php.
- Categories:
- heihachi's blog
- Add new comment
- 706 reads

Recent comments
5 hours 8 min ago
8 hours 57 sec ago
1 day 10 hours ago
1 day 16 hours ago
4 days 1 hour ago
4 days 1 hour ago
2 weeks 1 day ago
3 weeks 7 hours ago
4 weeks 2 days ago
7 weeks 5 days ago