How about adding this to phptemplate_preprocess_page() ?

It adds a link to a stylesheet on a per-page basis if the stylesheet exists.

  // Add page stylesheets.
  if($vars['is_front']) {
    // special style sheet for home page
    $cssFilename = drupal_get_path('theme', $GLOBALS['theme']) . '/css/home-page.css';
  }
  else {
    // all other pages get a style that looks like page-node-1.css or page-node-add.css etc.
    $path = drupal_get_path_alias($_GET['q']);
    $cssFilename = drupal_get_path('theme', $GLOBALS['theme']) . '/css/'.phptemplate_id_safe('page-'. $path) . '.css';
  }
 
  if(file_exists(getcwd() . '/' . $cssFilename)) {
    $vars['styles'] .= '<link type="text/css" rel="stylesheet" media="all" href="'.$cssFilename.'?L" />' . "\n";
  } 

Now all a user would need to do to include a new stylesheet for a page would be to create a new stylesheet with the correct name and it gets automatically included on that page.

Comments

authentictech’s picture

Component: Code » CSS/HTML Markup

This looks like a good feature and certainly fits in with what I was looking for today. Has anyone had the chance to test it?

I'm not sure about having it included in the Zen theme by default as it could be beyond the remit of a starting theme, but mentioning it in the Zen manual as potential customisation would be a bonus (if it was tested and shown to work well).

authentictech’s picture

Component: CSS/HTML Markup » PHP Code
akalata’s picture

Status: Active » Closed (fixed)

Closing old/inactive requests.