php - Drupal 6 Page templates depending on node type -
i trying theme node page based on content type. here tried follow instructions in http://drupal.org/node/249726.
what did , copied node.tpl.php file theme directory. renamed page-node-mycontenttype.tpl.php , wrote preprocess function in template file shown in above link.
apparently found displays node contents not common layout elements(html) (logo,header, footer , sidebars etc. defined in page.tpl.php).
so necessary me define same common layout elements(html) once again (those defines in page.tpl.php) in page-node-mycontenttype.tpl.php?
if have manage 2 template files. html changes need done twice in both template files.
is there better way of having common layout template file referred both page , node content type middle content area coming 2 different files (page or node content type)?
could please suggest common practice , way achieve this?
note: make sure override node template file respect content type both template files node.tpl.php , node-[content_type].tpl.php file need in theme directory.
the file you're looking node-mycontenttype.tpl.php . want node template, not page template. if rename page-node-mycontenttype.tpl.php node-mycontenttype.tpl.php, you'll result you're expecting.
the page template (page.tpl.php) in drupal defines overall markup , contents of various regions outputted. traditionally includes logo, menu, footer message, , few other static elements. drupal theme system allows override entire page template specific node type (which ended doing), based on explanation, you're trying override node template.
further reading: explanation & diagram of files control pieces of output: http://drupal.org/node/171194 general documentation on overriding output in theme system: http://drupal.org/node/341628
when reading above, make sure note version of drupal applies (there's tag @ top of each page). things changed dramatically between 5 , 6 , have shifted again (though not much) between 6 , 7.
Comments
Post a Comment