Drupal Tutorials

A Practical Tutorial on Getting Started with Drupal CVS

Some time ago, I attempted to figure out how to use Drupal's CVS. Going through their guide, I found this "guide". As scanned through the guide and gave up. I think I'm not the only one who gave up early on. The documentation was riddled with some of the most magnificently obtuse writing I've ever seen. Take for example:

Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard−conforming simple HTML designed for human modification.

In short, that's why I'm writing this. CVS is a piece of cake. (warning... not destroying your installs is a whole nuther' ballgame... do not "experiment" on live sites.) Pay attention, this is easier than you think:

A Taxonomy Menu That Goes to 11

Khalid Baheyeldin writes me asking:

Do you have your own version of taxonomy_menu? I used it in the past, but did not like it because it is an obscure item in the navigation menu. So, I am wondering how you configured the "browse" block on your site?

Khalid is actually the developer behind the feedback.module and the sitemap.module. Those modules are highly recommended, btw.

Preface(for kicks)

Requirements: Civicspace 8.1+, or Drupal 4.5+ with the Taxonomy_Menu Module Installed

A Practical Tutorial on Working with Nodes

Web Development:

Every Drupal user, at one time or another, has fantasized about having full control over their nodes (That was an odd sounding sentence wasn't it?). Well, fantasize no more, because at this early hour in the morning I will show you one damn useful trick.


Let's say I wanted to include the body of a single node into multiple pages, and have the option of nesting those nodes into infinity. Such an include would not only have the advantage of displaying with perfect consistancy across multiple pages; most importantly, it would only need to be updated at one location. And let us also pretend that piece of content happened to be a quote by George Carlin.

Though the Carlin's quote has a path alias, its fairly easy to figure out that its node ID is 415. How do you find a node ID? Well its simple, silly. Usually you can just look at the URL of the node. The number is the node ID. (e.g. yoursite.com/node/666 = node id 666).

Armed with our node ID of 415, I am now able to load the noad.

$MrNode = node_load(array("nid" => 415));
print $MrNode->body;?>
<em>-<?php print $MrNode->title;?></em>

In line two, we load our node... in this case 415. $MrNode, the name for the node we loaded is actually an array of information. To print him properly, we must be more specific than simply "print $MrNode;". So in this case, we've printed $MrNode's body (i.e. $MrNode->body ). Finally, on line 4, we print the node's title within italics. Below, you see this beautiful code in action:

415)); print $MrNode->body; ?>
-- title;?>

Here is a link to the node which we are using. Cool, huh?

How to Build the Ultimate Drupal Navigation System

This is a tutorial on the theory, and methods used to create this site's multi-level top navigation menu. The tutorial covers everything from obscure drupal php fuctions to generate custom dynamic menus, to advanced CSS techniques and practices. Warning: this tutorial will forever change the way you see drupal's navigation, and CSS. That's a promise (so long as you aren't already an expert).

Using CSS to Generate Expanding Horizontal Navigation Menus in Drupal

Not to toot my own horn, but everyone loves this site's top navigation menu. I've received more questions about how I did it than I can answer. As a result, I've decided to write a tutorial on it. Before beginning this tutorial, the reader should be somewhat familiar the following:

Also, be sure that you have installed PHP-Template, and a fresh copy of Box_Grey on hand.

A Practical Tutorial on Drupal's Menu System

In this tutorial, I will explain how to generate custom menus that are fully controlled from the menu administration page. (path: [www.yourdrupalsite.com]admin/menu). These menus can be enormously useful. The can be used for everything from custom user interfaces, to navigation menus. In addition, since they are hooked into Drupal's core, they can be dynamically updated.

In writing this tutorial, I've assumed that the reader already understands to some extent:

  • Drupal Themes
  • How to copy and paste
  • The value of attempting something for the first time. 

theme_menu_tree() = your new best friend

Alright, we're going to call a php function. O, non-php programmers do not flee in horror. PHP is easy, unless you're paying me, in which case its very difficult.

Using PHP to Dynamically Switch Drupal Themes and Templates

One powerful trick to improving the way a drupal site flows is switching page templates when certain PHP arguments return true. This is a quick tutorial on how to do that.

Step One: make three copies of page.tpl.php and the name them "frontpage.tpl.php", "admin.tpl.php", and "inside.tpl.php".

Step Two: Open page.tpl.php with an editor. Erase everything.. and I do mean everything, we're building this from the ground up. (get the coffee ready)

Step Three: copy the following code into page.tpl.php:

<?php if (arg(0) == 'admin') { include "admin.tpl.php"; } if ($is_front) { include "frontpage.tpl.php"; return; }else { include "inside.tpl.php"; ?>

Step Four:Test to make sure that indeed your different templates are


Subscribe to RSS - Drupal Tutorials