Theming a CCK Node

Posted on Jan 22, 2008

It's easy to create a custom node with CCK, but what if we want to change how the node looks by default? It's a step up from theming your submitted and your terms code, but it's not really that hard. The main difference between theming the CCK node and the regular node is that in node.tpl.php, we have several content sections within a node, so rather than just printing $content, we will print out parts of the content individually. I will use code from the wallpaper node type of this site for my examples.

Step 0, before we get to the phptemplate part of this tutorial, you have to think to yourself if you really need to theme a specific node programmatically. In many cases, you can style a node just fine with CSS only, so first imagine how you want to theme your node and determine if you really need to get into the templating engine.

Subsequently...

6 steps to a fancy custom taxonomy menu with term images

Posted on Jan 14, 2008

This tutorial will outline the steps to create and awesome looking taxonomy menu, using Imagecache, Taxonomy Image, Views, and some SQL. I will make this blog post the first one to be labeled ‘expert' in my skill level taxonomy, but that's really just there to look cool ;). I will explain the code step by step, and if afterwards, all 11 (!) lines of code make no sense at all, you can copy and paste the code.

Prerequisites:

  • A vocabulary with some terms
  • Imagecache
  • Taxonomy Image
  • Views
  • publipublic file system, this is needed for imagecache. However, there is an imagecache patch somewhere
  • ...

Drupal Howto: Adding a nifty metadata box to your nodes

Posted on Jan 8, 2008

In this tutorial, we will be adding a container with metadata about your node to our node template. To see what I mean, look at the bottom of this node page. Code snippet is plug-and-play, so you can plug it right into your custom theme, or one of my own Drupal themes.

The box in question can contain any node information we want, such as link information, to ensure the blogosphere can link to us effortlessly, or statistical data about our node (hits etc.).

For starters, we're going to add a simple container to our node that contains a html link, a BBcode link, and the trackback url of our node. Open up your node.tpl.php file, and add a new div element at the end:

Magento is coming

Posted on Jan 6, 2008

If you haven't heard of Magento yet, it's the new open source ecommerce platform that's going to blow ubercart and oscommerce out of the water! A stable version has not yet been released but yet their sourcecode has already been downloaded over 100,000 times. The stable 1.0 version is planned to be releaed in the first quarter of 08, so it won't be long until we see magento shops spawning allover the web. You can check out the demo here

Magento is also going to be integrated with Drupal...

Drupal Adsense Trick #2: adblocks between teasers

Posted on Jan 4, 2008

This article is the sequel to my first drupal adsense article. This time we're going to put adsense blocks in between teasers, on for example our frontpage. Same as last time, this does not require any modules, nor does it depend on adsense, it works with any phptemplate-based theme and with all sorts of ad code.

For starters, we're going to create a new block region. If there is not a template.php file in your theme folder, create one and open it up. See if there is a block regions function, if there is, add a new block to it: 'betwteasers' => t('between teasers')

If you didn't find a block region function copy this code into your template.php file (this code should be in between <?php and ?> tags):

function yourtheme_regions() {
return array(
'right' => t('right...

Introducing: Drupal Wallpaper Repository (2.OH!)

Posted on Dec 21, 2007

Theming Drupal Comments, Exemplifying with Garland

Posted on Dec 4, 2007

Part 1 - enhancing the comment layout

When browsing the drupal showcase forum I notice that few people take the effort the theme the comments, which is strange because comments are not only a very popular feature, but also exceedingly easy to theme!. For this comment theming tutorial we're going to spice up the comment template of the default Garland theme with some additional styling and a date widget just like the one in my latest free drupal theme Delicious Fruit.