Skip to Content

Drupal Planet

Use a different template based on node type

Posted in

Insert this code into template.php

function phptemplate_preprocess_page(&$vars) {
  // are we on a page that displays ONE node?
  if (arg(0) == 'node' && is_numeric(arg(1))){
    // Then let's get the node object
    $node = node_load(arg(1));
    $suggestions[] = 'page-'.$node->type;
    $vars['template_files'] = $suggestions;
  }
}

Ubercart - running straight out the box

I am working on a type of advanced profile (actually zipped site and sql dump) that will enable others to get Drupal and Ubercart 2 up and running within minutes.
You can see and USE the demo at http://ubercart.venturacottage.com Out the box it has been configured to handle:

Themeing tutorial using Color module

With an eye to the forthcoming Drupal 7, I was keen to encourage everyone to look at developing stunning themes to go with this shiny new release and all with the help of the excellent Color Module. It also applies to Drupal 6 and uses Garland as its starting point.

in /themes make a copy of garland folder > rename say swirly (or whatever your theme is called)
in /themes/swirly rename garland.info to swirly.info

Splash theme

Posted in

This is a recolourable multi-column liquid/fixed layout theme, that uses the Color module to change the theme colour without any need of coding.
It has an optional frontpage layout that uses promoted pages as a full page slideshow. Also built in is the ability to have different banner headings (and logos) for different sections of the website. available now from our store

apple no pic

For articles such as this one that have no accompanying image, we use coding within the theming layer of Views to add a default thumbnail image if the story appears on the frontpage. This relates to the tag that is attached to the story so for example in this case the apple tag is translated into the parent taxonomy of fruit.

Coding then checks the image directory for fruit.png and serves it up next to the relevant title.

The code looks something like this:

<?php

if($output==''){

Semi transparent navigation background

Looking at ways to make the excellent superfish dropdown navigation less prominent - I chose a lighter colour at the bottom of bg-header.png, added an off centre photo to the LHS that slightly cut behind the start of the navigation bar and then added the following code to the style.css

#superfish-inner .menu li {
  background: #B1E1EF;
  opacity:0.7;
  filter: alpha(opacity = 70);
  }

The filter: line is a duplication of the opacity: line but it is required for it to work in good old IE.

The end result can be seen opposite

Relative elements and dropdowns

Various Drupal themes now use the excellent Superfish dropdown menu navigation, including Pixturerr. But if you then customise the theme such as adding a frontpage with RELATIVE elements you can find (as in the picture) that the dropdows appear BEHIND other elements, in good old Microsoft Internet Explorer!. This is what I did to resolve the issue.
go to admin/build/themes/settings/pixturerr

we need to set the color set back to Girly Pink default

Revitalising a Quotations section

Sometimes it can be a challenge to explain to a client the practical benefits of moving from a static hand coded website to a content management system, such as Drupal. Phrases like "the content is seperated from the styling" can make their eyes start to glaze.

Black Garland Theme Mod

See screenshot opposite.

I have zipped the mod and it is available at the bottom of this article














Add background image to node

Client brief:

Show the different styles of illustration INCLUDING within the welcome article.

Method:

Using Firefox's Firebug I identified the div controlling this articles elements as:

<div id="node-30" class="node sticky">

Firstly I tried adding properties to:
.sticky but that would limit the use of this feature - so instead

In [theme]/style.css i added the following

#node-30 {
padding: 1em;
background: #000 url(http://www.leetoons.com/images/total.jpg) repeat-x

scroll 0% 100%;
border: 1px solid #e7e0db;

Syndicate content