0

I'm using phptemplate_preprocess_page() to add a set of style-sheets which are only needed for a certain content type.

function phptemplate_preprocess_page(&$variables) {
  if ($variables['node']->type == 'example') {
    drupal_add_css(path_to_theme() . '/css/example.css');
    $variables['styles'] = drupal_get_css();
  }
}

The problem is that my added style-sheet is added to the top of the list, which results in undesired behavior. For example, let's say that in my main theme style-sheet I define the font-size of p to be 11px, but in my example.css for this specific content type I need it to be 15px. The main style-sheet is added via the .info file of the theme.

It seems I can only think of icky ways to add my specific style-sheet at the bottom of the list, or at least below the theme default ones.

Is there any proper way to order them?

1

OK, of course, a few moments after adding the question I saw what was wrong. Since I did not specify the type it added my style-sheets it added it to the end of the modules. I now added the theme type and it was added at the end of the list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.