Drupal 6中特定节点的自定义模板? [英] Custom template for specific node in Drupal 6?

查看:113
本文介绍了Drupal 6中特定节点的自定义模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有很多不同的自定义模板文件,如page.tpl.php和node.tpl.php等。但是有没有办法为特定的节点ID制作自定义模板?这不支持node-3.tpl.php,但是有没有办法完成这个?



更新代码

  function phptemplate_preprocess_node(& $ vars){
$ vars ['template_files'] [] ='node-'。 $ VARS [ NID];
}


解决方案

对于Drupal 6,模板是page-node-3.tpl.php,并在 http://drupal.org/node上阅读手册/ 1089642



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



感谢@Clive和@asiby。


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

解决方案

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.

这篇关于Drupal 6中特定节点的自定义模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆