Drupal Tutorials

A CSS ID for Every Menu Item

As you can see, these menu links have unique icons. Yet another miracle accomplished using Drupal's PHPTemplate. This technique is especially cool because it automatically generates CSS ID's from the menu link's name.

TEMPLATE.PHP: Override theme_menu_item() (includes/menu.inc)

<?php function phptemplate_menu_item($mid, $children = '', $leaf = TRUE) { return _phptemplate_callback('menu_item', array( 'leaf' => $leaf, 'mid' => $mid, 'children' => $children )); } ?>

Now create a menu_item.tpl.php file.

Overriding Themeable Functions: The Where's, the Why's, and the How's

There's good news and bad news. First, the good news: overriding theme functions is easy. The bad news: every theme function is different, and there isn't a standard proceedure of going about it; if you don't know what you are doing, its quite easy to accidently do something ugly, or foolish.

So, in the next few tutorials, we are going to explore the hows, whys, why nots, and what ifs of overriding theme functions. Each of these functions will present a different set of challenges, and opprotunities to do something stupid, etc. Today's lesson is "Building a better node form". In this tutorial you will learn

Extreme Drupal Theming with PHPtemplate

Drupal's phptemplate is the most powerful, simple, and flexible templating/theming system on the planet*. Yet, it seems that the majority of drupal themers, (and wannabe drupal themers) are ignorant of its true power.

More disturbingly, vast numbers of people still insist that Joomla!, typo3, and wordpress's templating systems are easier, sexier, and slicker. These people are either loony, or wrong.

As an expert in PHPtemplate (isn't that scary), I've decided its my duty to show the true power of PHPtemplate to world.

Consider these tutorials, a proper (and steadily growing) introduction to drupal's templating system.

An Introduction: Dominating the User Login Form

In this first tutorial, you will learn how to:

  1. override the default presentation of the user login form, and create a custom template for it.
  2. pass an editable node into the user login form
  3. alter the form’s values (such as text, and instructions)
  4. make the form available to page.tpl.php — as though it was something as simple as a footer.

Moreover, I will show you how bloody simple it is. Folks who follow this tutorial should already have:

  1. knowledge of PHP
  2. the ability to lie about a lack of knowledge of PHP
  3. some familiarity of the kindergarden basics of drupal theming
  4. Be working with drupal 4.7+

Step One: Override the deafult user login form

Overriding is always done in the theme’s template.php file (if you don’t have a template.php file, you may create a it now). Obviously, before you can override anything, you must first locate what you are trying to override. The best way to do this is to search a module for the $form variable.

A Very Timely CVS Command

Tags:

Normally I wouldn't double-dip the planet like this, but this is truly a nugget worth sharing. For the last few months you, like me, have probably been working off of the CVS head. However, as Drupal 4.7.0 is SO close, its time we return to the land of sanity. Imagine, my brothers and sisters: soon, we can checkout modules and EXPECT them to work! Truly glorious.

Unfortunately, as we all know, if we update our collection of modules and core files using the 4-7 tag, we'll lose all modules that aren't tagged for 4.7. For some time, I thought this was just "the way it was". But then, Dave Cohen brought this gem of a command to my attention.

Taking Drupal's Marketing to the Next Level

Someday, I'll have a chance to design some halfway decent drupal ads. In the meantime, however, I can only offer some general thoughts on how Drupal could become the poster child for good grassroots open source marketing.

The Focus of Our Marketing SHOULD NOT BE Drupal

Drupal's biggest problems, in terms of marketing is two fold:

Building Dynamic CSS Classes With Taxonomy

Michael Angeles' post on creating different looks for different sections by switching body classes and ID's inspired me to write up a related method.

The advantages of this method are that it dynamically builds classes on the basis of vocabulary and term that allow you to have wildy different styles for every node.

This method requires two parts, one snippet in your template.php file, and a special body tag in your page.tpl.php file.

On the Joys of Raising Free-Range node.tpl.php Links

Ah, chickens -- delicious chickens. Its a timeless truth, however, that not all chickens were born equal. And clearly, the best tasting chickens are those who've been allowed to feed, graze, and socialize on the open range.

10 Minutes to a Better Drupal User Interface

I'm not a betting man. However, I'd bet you 25 cents that your users will have a much easier time learning how to use Drupal with the interface I've designed below:

 

WHY? 

This interface is superior to the drupal defaults for a couple key reasons:

1. We can assume that if someone is using your website, they are already familiar, and comfortable with this type of navigation. Nearly every desktop program, from Firefox, to MS Word, to Photoshop, to Explorer, to the Macintosh Finder use this UI pattern. Always seek to design interfaces which your users will already be familiar with.

Investigation of Drupal's Menu System Uncovers Unexpected Treasure

Today, I spent quite a bit of time wandering drupal's menu system in search of answers. But instead, I uncovered two techniques which made me rethink the questions I was asking. As the latter sentence suggested, I'm a professional writer of fortune cookies on the side (there aren't many of us left...).

Pages

Subscribe to RSS - Drupal Tutorials