Drupal 6 中特定节点的自定义模板? [英] Custom template for specific node in Drupal 6?
问题描述
我知道有大量不同的自定义模板文件,例如 page.tpl.php 和 node.tpl.php 等.但是有没有办法为特定节点 ID 制作自定义模板?这对 node-3.tpl.php 不起作用,但是有没有办法做到这一点?
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?
更新代码
function phptemplate_preprocess_node(&$vars) {
$vars['template_files'][] = 'node-' . $vars['nid'];
}
推荐答案
对于 Drupal 6,页面模板是 'page-node-3.tpl.php' 并阅读手册位于 http://drupal.org/node/1089642
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
Drupal 7, page--node--3.tpl.php : http://drupal.org/node/1089656
感谢@Clive 和@asiby.
Thanks @Clive and @asiby.
这篇关于Drupal 6 中特定节点的自定义模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!