greg.harvey's blog

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?

Contributing Hurts

in

Well, I'm in the throes of trying to contribute to core for the first time, and I have to say, it's a painful experience. Your concepts and code are suddenly thrown open to pretty fierce scrutiny by the community at large.

When you're making your own module no one really cares what you do, as long as it doesn't compromise the security or operation of other modules. Not so with core. There can be some pretty harsh debate around what can and cannot go in to the framework.

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

Theming Views In Drupal 6.x

Who remembers good ol' Views 1.x in Drupal 5.x? Lovely, wasn't it? With that theming wizard. Giving you all the phptemplate functions you needed for fine-grained theming, ready to paste in to template.php in your theme and fiddle with until everything looks perfect.

Baby, Don't You Loose Your Type On Me

Many programmers from beyond the realm of PHP, deep in the black country where the dragons reside, whinge like an Australian swim-coach about PHP's loose variable typing. Many PHP developers either don't know what this means or don't care. I didn't much care, until recently, where I got a practical lesson in why loose typing can, on ocassion, really suck.

Here are some interesting effects of PHP's loose typing:

<?php
$var1
= 1;
$var2 = '1';
print
'Result: '.($var1 == $var2);
?>

Theme Stops Play

And I was sooo close! I actually decided to upgrade to Drupal 6.4 this evening. All the modules I use are ready, everything works, so I was all set to take the plunge.

But my theme, Dichotomy, has not been ported. In fact, it's never even been marked a point release. =(

Looks like I'll have to either port it myself or change theme. Any suggestions??
http://drupal.org/project/themes

I kinda like this one, but it's a complete departure from the status quo:
http://drupal.org/project/interactive_media

Ditto:

Hearing Dogs For The Dead?

Yup, you read right. Totally off topic, but too good not to blog. One of the funniest typos we've seen in a good while! This email was sent by someone in the office this morning:

________________________________________
From: **** *******
Sent: 28 August 2008 10:09
To: Everyone
Subject: Charity Dressdown Day - Collecting for Hearing dogs for Death People

Hi everyone,

drupal_execute Gotcha In Drupal 6.x

Many of you are probably familiar with drupal_execute(). However, those familiar with it from Drupal 5.x days will have to watch a new feature in Drupal 6.x.

Here's an example of an item in a hook_menu() implementation in the Taxonomy module for Drupal 6.x:

<?php
$items['admin/content/taxonomy/add/vocabulary'] = array(
'title' => 'Add vocabulary',
'page callback' => 'drupal_get_form',
'page arguments' => array('taxonomy_form_vocabulary'),

Drupal Strikes Again

Finally the Beta of Mums+, the community site for parents, is live. I finished off the spit and polish today. Some way to spend a public holiday!

Anyway, if you're curious take a look:
http://www.mumsplus.com

The Beta version is focussed around the Stoke Newington area of North London, but if it is a success the idea is to branch out using Drupal's multi-site capabilities, or perhaps db_rewrite, and create area-by-area sub-domains. Hope it works. Both myself and my friend Liz have put in a lot of effort thus far.

SOA And Drupal - The Services Module

So, you want to create an SOA-based infrastructure for some or all of your business tools and web sites? Not sure where to start?

I'll admit I have worked a little with Microsoft web services, but I am fairly ignorant of the open source alternatives out there for SOA. What I can tell you is I'm hugely impressed with the new Services module for Drupal. It is still in dev, but it's pretty cool!

Syndicate content