Insert this code into template.php

function phptemplate_preprocess_page(&$vars) {
  // are we on a page that displays ONE node?
  if (arg(0) == 'node' && is_numeric(arg(1))){
    // Then let's get the node object
    $node = node_load(arg(1));
    $suggestions[] = 'page-'.$node->type;
    $vars['template_files'] = $suggestions;
  }
}

In my case I created a content type called 'hub' and then a page-hub.tpl.php adapted from the standard page template (don't forget to clear the cache via admin/settings/performance, or you wont see a change). Don't forget to add in something like this into the head section of your new template, so you can style it separately

  <link type="text/css" href="<?php print base_path() . path_to_theme() ?>/page-hub.css" rel="stylesheet"/>

further reading:
http://drupal.org/node/249726

Tags: 

Add new comment

Filtered HTML

  • To post pieces of code, surround them with <code>...</code> tags. For PHP code, you can use <?php ... ?>, which will also colour it based on syntax.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Strips broken/unpublished internal links from output.
  • Adds node titles to internal links found in content (as HTML "title" attribute).
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.