Customized page layout according to node type

This article is based on Drupal 6 series, and php template is used! How to layout your site according to node type?

Easy!! Do it as following steps:
  • Create page-*.tpl.php files, the asterisk(*) sign is stand for node type, such as page, story ... etc. These file is used to display content for concrete node type.
  • Copy the original page.tpl.php to page-default.tpl.php , which is used to display content for common node type.
  • Create a new page.tpl.php file, which is used to load page-*.tpl.php file according to the node type, looks like:
<?php 
if('page' == $node->type){
  require_once('page-page.tpl.php');
  return;
} 
elseif('story' == $node->type){
  require_once('page-story.tpl.php');
  return;
}
else{
  require_once('page-default.tpl.php');
}
?>  

Comments

SMfHFfdriJNIhYi

dfbEfY lwmthlyidrjh, [url=http://ersqmhbxlzzb.com/]ersqmhbxlzzb[/url], [link=http://wrxrrmgtzwqe.com/]wrxrrmgtzwqe[/link], http://orfqcxmtwhkb.com/

aGVIHDLVpauBfaerF

nplkIQ rynytdbcnnik, [url=http://bkpysgkilrzo.com/]bkpysgkilrzo[/url], [link=http://kasywdsgmhnr.com/]kasywdsgmhnr[/link], http://zuzjopsufxlw.com/