Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can write your own rules in template.php file of your theme. I'm often use this trick not for different modules, but for different paths.</p> <pre><code> if ($vars['is_front']) { $vars['template_files'] = array(); if (file_exists(path_to_theme().'/page-front.tpl.php')){ $vars['template_files'][] = 'page-front'; } if (file_exists(path_to_theme().'/style-front-ie6.css')) { $vars['ie6_style'] .= "\n".'&lt;link type="text/css" href="/'.path_to_theme().'/style-front-ie6.css" rel="stylesheet" /&gt;'; } if (file_exists(path_to_theme().'/style-front-ie7.css')) { $vars['ie7_style'] .= "\n".'&lt;link type="text/css" href="/'.path_to_theme().'/style-front-ie7.css" rel="stylesheet" /&gt;'; } if (file_exists(path_to_theme().'/style-front-ie8.css')) { $vars['ie8_style'] .= "\n".'&lt;link type="text/css" href="/'.path_to_theme().'/style-front-ie8.css" rel="stylesheet" /&gt;'; } if (file_exists(path_to_theme().'/style-front.css')) { drupal_add_css(path_to_theme().'/style-front.css', 'theme', 'all', FALSE); } } else { if (module_exists('path')) { $alias = drupal_get_path_alias(str_replace('/edit','',$_GET['q'])); if ($alias != $_GET['q']) { $template_filename = 'page'; foreach (explode('/', $alias) as $path_part) { $template_filename .= '-'.$path_part; $vars['template_files'][] = $template_filename; if (file_exists(path_to_theme().'/style-'.$path_part.'-ie6.css')) { $vars['ie6_style'] .= "\n".'&lt;link type="text/css" href="/'.path_to_theme().'/style-'.$path_part.'-ie6.css" rel="stylesheet" /&gt;'; } if (file_exists(path_to_theme().'/style-'.$path_part.'-ie7.css')) { $vars['ie7_style'] .= "\n".'&lt;link type="text/css" href="/'.path_to_theme().'/style-'.$path_part.'-ie7.css" rel="stylesheet" /&gt;'; } if (file_exists(path_to_theme().'/style-'.$path_part.'-ie8.css')) { $vars['ie8_style'] .= "\n".'&lt;link type="text/css" href="/'.path_to_theme().'/style-'.$path_part.'-ie8.css" rel="stylesheet" /&gt;'; } if (file_exists(path_to_theme().'/style-'.$path_part.'.css')) { drupal_add_css(path_to_theme().'/style-'.$path_part.'.css', 'theme', 'all', FALSE); } } } } } $css = drupal_add_css(); $vars['css'] = $css; $vars['styles'] = drupal_get_css($css); </code></pre> <p>Put this into template.php in phptemplate_preprocess_page function and now if you have a page with address <a href="http://example.com/catalog" rel="nofollow">http://example.com/catalog</a>, you can use page-catalog.tpl.php and style-catalog.css for it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload