开发者

drupal : How to set separate editing template files for each nodes?

开发者 https://www.devze.com 2023-02-11 22:03 出处:网络
I have a 3 page drupal(6.20) site, each page has its own template like page-node-1.tpl.php, page-node-2.tpl.php, page-node-3.tpl.php, I would like to set separate templates when editing each node, I t

I have a 3 page drupal(6.20) site, each page has its own template like page-node-1.tpl.php, page-node-2.tpl.php, page-node-3.tpl.php, I would like to set separate templates when editing each node, I tried

page-node-1-edit.tpl.php

but its not working, but page-node-edit.tpl is working, but its common to all nodes, I need separate editing templates for each node like page-node-1-edit.tpl.php and page-node-2-edit.tpl.php

Than开发者_开发问答ks a lot for your time


Add this function/or modify if exists into template.php of your theme:

function phptemplate_preprocess_page(&$vars) {
  // ...
  $node = menu_get_object();
  if ($node->nid == '1') {
    $vars['template_files'][] = 'page-node-1-edit';
  } 
  // ...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消