Easily Add Color Support To A Drupal Theme With DesignKit

Adding color support to a Drupal theme allows site owners/administrators to modify the theme's color scheme directly from a settings page, rather than having to edit any CSS.

Drupal color schemes

I'm currently assessing color integration options for Neptune and have found DesignKit to be a quick, easy, and flexible alternative to direct color module itegration (as used by Garland and Bartik). On the flip side, there are a couple of caveats (see below).

This tutorial will focus on implementing basic color configuration, although DesignKit also supports image configuration and more advanced color configuration (including color blending/shifting).

Read more →

Neptune - A New Zen Sub-theme

Neptune Drupal theme

A couple of weeks ago now I released the 1.0 version of Neptune, a new Zen 7.x-5.x sub-theme. Since then I've fixed and added a number of bits and today created a recommended 1.1 release. You can see the theme in action at the demo site.

Key features include:

  • Responsive design
  • HTML5 based
  • Sass/Compass integration
  • Single or multi-column layout
  • Configurable max width
  • Mobile friendly mini nav
  • Google web fonts (Montserrat for titles and Istok Web for all other text)
  • Dynamically generated triangle design
Read more →

My Drupal Blog - Case Study (Upgrade, Redesign, HTML5, Responsive)

I recently upgraded My Drupal Blog from Drupal 6 to Drupal 7 and implemented a newly designed and HTML5 based responsive theme.

My Drupal Blog home page

This case study details the processes involved.

Read more →

Embed Drupal Views Using PHP

When theming Drupal and wanting to output a view there are occasions where using a view display (e.g. a page, or a block - perhaps placed within a custom region ;-) ), or using Views Attach will not suffice.

Instead, you can embed a view using the following PHP snippet:
(NOTE: you'll need to have the core PHP input filter enabled if embedding in a node body)

<?php
$view
= views_get_view('VIEWNAME');
print
$view->preview('default');
?>

or, if you need to use an argument with the view:

<?php
$args
= array(ARGUMENTS);
$view = views_get_view('VIEWNAME');
print
$view->preview('default', $args);
?>
Read more →

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 :)

Read more →

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
Read more →

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
    Truncate Drupal view node title
  • check the ‘Trim this field to a maximum length’ checkbox, and adjust the settings as required
    Truncate Drupal view node title
Read more →

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.

Custom Drupal 6 theme region

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
Read more →

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.

No PHP in a Drupal footer message

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.

Read more →

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

Read more →

Pages