Syndicate

Feed

theming

Aug
20

Theming Drupal 6 from the module layer

Sometimes, you need to change the HTML markup output by some module, and you want your changes to keep whichever theme you will use. The need came up for me recently when I had to provide special markup for pages that display a webform. I had to quickly put together a module for a client, a module that would provide a template file, which I decided to name (arbitrarily) page-webform.tpl.php.

The situation may arise for you as well, so I will share my technique with you. Say you want to provide a template file for all pages that display one node of a content type with machine-readable name CONTENT_TYPE_NAME. And say you want to use a module to provide such template. Say you decide to name your module special_pageRead more →

Aug
12

Rubber band and no-spilling contest

Now that Firefox 3 and IE7 are out and raging (and IE8 available in beta), a new clearfix solution has received the seal of approval from the website positioniseverything.net. Caution: it may make you shake your head, blink slowly and say 'Whaa…?'. Read this old article and digg it. Let your clear-block class be changed to .clear-block { overflow: hidden; }
— Update

You may read the rest of my article, which was published on Wednesday, April 11th 2007. Read more →

One file is attached to this posting. Login or register to download this file.


Jun
17

Displaying the content type name

You want to print the content type name along with the 'submitted' info. This will be particularly useful for those who have created custom content types, with or without CCKRead more →

Jun
17

Theming comments by the node's author

You want the comment style to be different for comments added by the author of a node — who's commenting on his own node. For example, you may want to highlight the node's author's comments, so that any visitor skimming through the comments will easily differentiate them from other comments. Read more →

Jun
17

My top 10 favorite theming tweaks for content

Here is a collection of my 10 favorite 'tweaks' to content template files in Drupal 6. I will add one simple tweak a day, starting today.

May
27

Theming the contact form in Drupal 6

The following exercise consists in theming the contact form in Drupal 6. Once we're done, it will look like we'll have created two fall-back-on 'pages' for contact forms, one page/form to 'request a quote' at Randy.com/contact/quote, and an other page/form for general inquiries at Randy.com/contact/info. The trick here — if there's one — consists in theming the contact form differently based on the requested URI.

This exercise will show you how to:

  • recognize when a module has not registered a specific theming function for a form it generates,
  • register a theming function for a Drupal form in your theme, using HOOK_theme,
  • work with template suggestions,
  • use the Devel module function dsm() to inspect complex variables, such as Drupal forms.

 Read more →

May
09

Theming the node form in Drupal 6

The following exercise consists in moving pieces of code around, code that I did not write myself. Credit for the code goes to Joakim Stai (nicknamed 'ximo' on Drupal.org), the maintainer of the excellent Node form layouts module, as well as to the Usability group.

This exercise is all about gaining experience in:

  • adding theme settings to a theme configuration page
  • theming forms inside a theme, as opposed to writing a module for the same purpose
  • creating a sub theme

 Read more →

One file is attached to this posting. Login or register to download this file.


Apr
22

Building powerful and robust websites with Drupal 6

Packt recently published an expanded and updated edition of Drupal: Creating Blogs, Forums, Portals, and Community Websites. The new title is Building powerful and robust websites with Drupal 6, and it contains 362 pages with the index — 100 more pages than there was in the first book. The author, David Mercer, would like his book to become the Drupal community's de facto title for learning the technology Read more →

Apr
09

New Drupal theming ebook

I’m currently working on a Drupal 6 theming ebook. The beta ebook attached to this posting is for Drupal 5.
Update, March 29th, 2008.

I am in the process of writing a 50-and-some pages ebook on Drupal theming. I have an outline and a spiral book full of notes, and lots of sections are already written. My current draft (call that a beta-book) is 15 pages long and if you log in you may download it. Read more →

Because you are not logged in, you cannot see the 2 files attached to this posting. Login or register to download these files.


May
21

Theming the register form in Drupal 6

The following exercise consists in adding Terms of Use to the register form in Drupal 6. Provided that your website visitors aren't logged in, they can view the register form on the page myWebSite.com/user/register.

This exercise will show you how to:

  • recognize when a module has not registered a specific theming function for a form it generates,
  • register a theming function for a Drupal form in your theme, using HOOK_theme,
  • use the Devel module function dsm() to inspect complex variables, such as Drupal forms,
  • use the Theme Developer 'Themer info' widget to inspect those forms that only 'anonymous users' can see, for instance... the register form.

 Read more →

Feed