php

Root path based CSS in drupal

Sometimes I have wanted to make some simple changes to a drupal theme based on the current root path. The sections module does this, but I wanted a simpler way of changing elements in the CSS based on the current root path.

function _phptemplate_variables($hook, $vars = array()) { switch ($hook) { case 'page': if (module_exists('path')) { $alias = drupal_get_path_alias($_GET['q']); if ($alias != $_GET['q']) { foreach (explode('/', $alias) as $path_part) { $classes[] = $path_part; } }
Syndicate content