Custom template for specific node in Drupal 6?

2019-06-21 04:15发布

I know there are a ton of different custom template files like page.tpl.php and node.tpl.php etc. But is there a way to make a custom template for a specific node ID? This doesn't work node-3.tpl.php, but is there a way to accomplish this?

UPDATE CODE

function phptemplate_preprocess_node(&$vars) {
    $vars['template_files'][] = 'node-' . $vars['nid'];
}

2条回答
地球回转人心会变
2楼-- · 2019-06-21 04:35

Make sure that you rebuild the theme registry. Failure to do so will result in Drupal completely ignoring the node-x.tpl.php file that you will add.

查看更多
我只想做你的唯一
3楼-- · 2019-06-21 04:47

For Drupal 6, the page template is 'page-node-3.tpl.php' and read the manual at http://drupal.org/node/1089642

Drupal 7, page--node--3.tpl.php : http://drupal.org/node/1089656

Thanks @Clive and @asiby.

查看更多
登录 后发表回答