Hey all,
I'm a big fan of avoiding modules for little items like this. Does anyone know how I could utilize a php snippet in the template file to modify which stylesheet is added based upon the custom URL that is inserted for each page?
Here's the rundown of what I'm looking to do. There are five different section to the website. Each section will have a couple of different elements, namely a different background to the header and a different faded background to the inside of the content division. The rest of the structural elements of the website are remaining the same. Hence, based upon the type custom URL that is entered, I want to include a different background image.
For instance, when the url contains the string "apples", I would like to include the stylesheet that refers to the apples background; pears for pears stylesheet; etc.
I've been playing around with the following:
Various if/else commands using:
url("node/$node->nid")
(printed out the custom URL in Drupal 5.x but I was having some troubles with it in 6.x)
and the strstr command.
$haystack = 'php-homepage-20071125.png';
$needle = '-';
$result = substr($haystack, 0, strpos($haystack, $needle)); // $result = php