Drupal 6

Optimise your Drupal Theme for an iPhone or iPod

Added on 30th November 2010

To begin with, enter the following code at the top of your page.tpl.php file:

 

{syntaxhighlighter brush: php;fontsize: 100; first-line: 1; }<?php
if (ereg('iPhone',$_SERVER['HTTP_USER_AGENT'])) {
$iphone = 1;
} elseif (ereg('iPod',$_SERVER['HTTP_USER_AGENT'])) {
$iphone = 1;
} else {
$iphone = 0;
}
?>{/syntaxhighlighter}

This creates an 'iPhone' variable, and sets its value to 1 if the an iPhone is being used. The value of the variable can then be used in an 'if' statement to create content that's only shown if an iPhone is being used.

How to Create and Apply Patches

Added on 10th September 2010

Earlier this year, I posted a solution to an issue on the Drupal.org issue queue. Originally, I just posted the code back onto the issue, but have now created a patch that can easily be applied to any Drupal 6 installation. Here is a run-through of the process of creating and applying a patch. In this case, I made changes to the user_pass_validate function that's found within /modules/user/user.pages.inc.

Create a Better Photo Gallery in Drupal - Part 2

Added on 17th August 2010

At the end of my last post, I'd finished creating the first part of the new photo gallery, but I wanted to change the dates of the published photos to reflect the ones on the client's original website.  

Firstly, I'll refer to the previous list of published galleries that I created before, and create something different that also displays the created and modified dates. Picking the node ID of the required gallery, I used the following SQL query to display a list of photos.

 

Pages

Subscribe to RSS - Drupal 6