Drupal Planet
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.





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?