theming

Path To Theme In A Module

I'm currently working on a multi-site Drupal installation. There is one theming module shared by all instances which exposes some key blocks and views they all require. During development, this was built on the initial site, so occasionally you will find something like this in the module:

<?php
function load_my_image() {
 
$path = base_path().
         
drupal_get_path('theme', 'my_theme').
         
'/images/my-image.gif';
  return
$path;
}
?>

That works fine for as long as 'my_theme' exists, but what if it doesn't on another instance using this module?

The Joys Of Preprocessing

I've been having a lot of fun with preprocess functions in Drupal 6.x, particularly when theming Views. It's a great system, but my colleague came across a nice "gotcha" this morning.

We have been adding JavaScript in Views preprocess functions if we want to provide tidy jQuery interfaces for Views output. This works great, so we thought nothing of doing the same for pages, which is where we came unstuck.

To understand why, you need to understand the process order of preprocess functions, as defined here:
http://drupal.org/node/223430

Syndicate content