简体   繁体   中英

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

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

Thanks 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';
  } 
  // ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM