0

I have a Drupal 7 with several basic pages with repeated paths, for example:

1) /red-car/ford-and-chevy
2) /red-car/nissan-sport
3) /red-car /renault-mazda
4) /blue-house/mexico
5) /blue-house/colombia
6) /blue-house/el-salvador

How can I add a file red-car.css for "/red-car/" and blue-house.css for "/blue-house/" from template.php?

0

You might want to do something like this in your template.php file.

function MYTHEME_preprocess_node($vars) {
  switch (arg(0)) {
    case 'red-car':
      drupal_add_css(drupal_get_path('theme', 'MYTHEME') . "/css/red-car.css");
      break;
    case 'blue-house':
      drupal_add_css(drupal_get_path('theme', 'MYTHEME') . "/css/blue-house.css");
      break;
  }
}

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.