Drupal Theming
Help Test The New Drupal.org Theme
Just passing along this call for testing of the new Drupal.org theme - How to verify Mark Bolton’s mockups against the staging site - which I saw in my feed reader this morning. Seems like readers of this blog would be the perfect candidates :)
Drupal Theming + jQuery Basics (inc. Drupal Behaviors)
In this tutorial you'll see how to implement a toggling effect using jQuery within your Drupal theme whilst utilising Drupal behaviors.
The finished effect can be seen in this Drupal jQuery demo.
The toggle is achieved via a two-step process:
- Step 1 - add content and markup to a node
- Step 2 - implement jQuery, utilising Drupal behaviors, which will enable the toggling to work
Truncate A Drupal View Node Title
UPDATE
It appears that I missed the very obvious solution to this problem (!) which, as pointed out by a couple of commenters, is to use the ‘Trim this field to a maximum length’ option within the settings for the node title field.
I’ll leave this post in place as I think it still serves as a useful guide on how to create template override files for views, but please be advised that for implementing truncation of a views node title it is easier to:
- navigate to the view's 'Edit view viewname' page (/admin/build/views/edit/viewname) and click the ‘Node: Title' link
- check the ‘Trim this field to a maximum length’ checkbox, and adjust the settings as required
Creating Custom Regions In Drupal 6 Themes
Previously, I covered the topic of creating custom regions in Drupal 5 themes. However, Drupal 6 introduced a new process for creating custom regions in themes and it is still one of the topics people ask about most frequently.
So, here's a tutorial on how to create custom regions in your Drupal 6 themes. In this example I will use the Garland theme, and insert a new region called 'Uber content', which I'll position above everything in the main content area.

It's basically a two-step process:
- step 1 - define the custom region in your theme's .info file
- step 2 - insert some PHP in your theme's page.tpl.php file wherever you would like the new region to appear
Using PHP In Your Drupal Theme's Footer
The problem:
Drupal’s default 'Footer message' area (to which you can add content via the admin section - Administer > Site configuration > Site information) will not parse PHP.
If, for example, you add a copyright message to your footer message area such as "© Copyright 2009" it'll be fine until the New Year begins and you have to go in and manually change it to "© Copyright 2010". So, instead, it would be great if you could handle the date dynamically using the following PHP code (see http://php.net/date for further PHP date details):
© Copyright <?php echo date('Y'); ?>However, try adding that to the default 'Footer message' area and it will simply output the entirety of the code as text, ignoring the PHP tags.

So, what to do?
Solution 1:
Create a block (admin/build/block/add) containing the code, set its input format to PHP, and then place that block in the footer region via the main blocks settings page (admin/build/block). Crazy simple.
My Drupal Blog RSS Feeds Updated
Just a quick note to say that the My Drupal Blog RSS feeds have been updated.
The local URLs are still the same:
Posts - http://mydrupalblog.lhmdesign.com/rss.xml
Comments - http://mydrupalblog.lhmdesign.com/crss
But the FeedBurner URLs are now slightly different:
Posts - http://feeds2.feedburner.com/MyDrupalBlog
Comments - http://feeds2.feedburner.com/MyDrupalBlog-Comments
Been A While!
Work, work, and more work have meant that I’ve rather neglected this blog as of late. But no more! Content is a-comin’ (slowly ;) ). And just a quick heads up for any comment RSS feed subscribers - I know that the feed is borked, and I may have to temporarily disable it whilst I resolve the issue (if, of course, I can access the Feedburner site, which is currently down). Fun times!
Drupal Theming News
There are two big Drupal theming discussions happening right now, which I'm sure a number of you are aware of, but for those who aren't here's a quick summary:
1. Project Plan For A New Default Drupal 7 Theme
First up, lots of interesting stuff regarding the Project Plan for a new default Drupal 7 theme.
Right now this is a wiki page with an 8 step plan addressing the question of 'How do we get a new default theme in core?'. Step 1 'Create a project plan' has its due date set at November 7, 2008 so get in there quick!
Also, it looks like there will be a theming contest to create Drupal 7 sub-themes for core, once the new base theme has been finalised, which I'm sure will be of interest to a number of themers out there.
2. Drupal.org Redesign
Secondly, lots of discussion regarding Prototype Iteration #5 (including initial visual design direction) of the drupal.org redesign, which has gone online here.
Comments, discussion, suggestions etc. are welcomed by the authors on both of these topics.
Drupal API Dreamweaver extension important update
Just a quick note to say that Chris over at xtnd.us contacted me recently regarding the updated Drupal API for Dreamweaver extension.
It's now in beta 2 with a full release expected for Q4 2008, and according to Chris "code coloring works, plus Dreamweaver can understand Drupal file types naturally now - like .module, .info, .theme, .install, etc."
You can find links to other xtnd.us Drupal products here.
Build An Aggregation Site With Drupal (Part 3)
Previously...
In Build An Aggregation Site With Drupal (Part 1) and Build An Aggregation Site With Drupal (Part 2) I covered setting up the foundation of your aggregation site using Drupal and SimpleFeed and then using cron to auto-update content and views to create the site sections and RSS feeds for our content.
In this third part of the series I'll look at theming the news items, and finally in part 4 some extra touches including filtering options for our users. You can check out the finished aggregation site (parts 1, 2, and 3) here.
Step 1: Set up the new theme
So far during this tutorial series I've been using a clean install of Drupal with the default Garland theme enabled.
Now that we'll be making various changes to the site's theme it's best to set up a new version of Garland in your site's sites/all/themes folder which you can then enable and edit instead of the default Garland theme (which is located at themes/garland) thus keeping the original Garland theme intact.





Hi, I'm Laurence and this is my Drupal blog.
Don't Make Me Think!
Pro Drupal Development
PHP Cookbook
Will You Please Be Quiet, Please?