drupal

Theming Sidebars and Panels

Here’s a pretty basic css technique I’ve noticed myself using a lot of lately (not at all my own invention). The divs used as examples come from zen theme.

Often a design calls for putting a background (or border) on a sidebar. It should look as so:
goal
If you haven’t been down this route before, you will probably try something like

#sidebar-right{
  background: #123456;
}

Node theming by field: deconstructing $node->content in Drupal 5

The CCK ‘display fields’ settings are very useful for theming nodes by content type, but I often find myself having to get further into customizing node output field by field.

Once I decide there’s no way getting around taking finer control of my node’s fields, I create a node-{type}.tpl.php by copying my existing node.tpl.php and open up Devel’s ‘Node Render’ tab. Then I delete the $content variable from the template and start adding things like

<?php
print $node->content['field_image']['#value'];
?>
and
<?php
print $node->content['body']['#value'];
?>
The $content variable is nice for amateurs, but we need the unrendered $node->content to get good control of a node.

While this gives me complete control over the output of the node’s fields, the drawback is that now if I add a new field to the node, or if I add a module that adds something to $node->content, I have to go back to my template and add in this new element. Because I often do my theming and development in parallel, this can be rather annoying, and there is also a danger that I could overlook doing it.

Therefore I think it may be more practical to use code like this in the node template:

Module: MyAccount_alter

I often find myself needing to get rid of some of the sections on Drupal’s ‘My Account’ page. Not every site needs it to say ‘History: Member for 1 day’ for example, and if you use a lot of contributed modules that screen can get cluttered fast. So this morning I got sick of dealing with it, found there is a perfectly good hook_profile_alter there to work with, and wrote a little module to let administrators disable these fields. Let me know how you like it: http://drupal.org/project/myaccount_alter (currently Drupal 5 only)

Drupal Time-savers

If you work freelance like I do, you know that time is money. I’m always trying to shave a few more seconds off my development time. Here are a few tips and tricks that I constantly use:

Project: cfdv.org

CFDV.org is the website for the The Chromatography Forum of Delaware Valley. Chromatography is a discipline of chemistry which is used to separate mixtures for analysis. For example, when your aspirin is tested to be 99.7% pure that was determined with chromatography by an analytical chemist. Likewise when your urine is tested to contain marijuana that was also determined by chromatography. Chromatography is a complex science and is used extensively in the pharmaceutical industry- an industry which has a large presence in the Delaware Valley.

Project: OnlyAlumni.com

One project I’m currently working on which is already live is OnlyAlummni.com.

Instead of having to build the entire site, I have a smart client who set up the site and had me work only on the trickier (fun) parts of this project. OnlyAlumni is a social networking site with about 8000 colleges, fraternities and sororities which operate as Drupal organic groups. This has been a great project for me to go much more in depth with organic groups and related modules.

Teleport module

I am loving this drupal 6 teleport module. Thank you ‘incidentist’. It really is quicksilver for drupal. You type in a few letters and it autocompletes paths you might want to visit- no mouse involved. For example, to post this story I pressed ctrl-T ‘stor’ enter-enter, and it took me to node/add/story.

Admin_menu: my loyalties have shifted. Our time together was pretty good, but you can’t compete with keyboard shortcuts.

Lullabot trip - Portland

I just got back from Portland where I took Lullabot’s advanced drupal development course. Not only did the class take me to a wild new level of Drupalhood, but I was blown away by how great a city Portland is. It made me feel the intense masochism of the act of living in Philadelphia. Every detail was greeting me with unexpected good things, as opposed to Philly where every detail is just another slap in the face. Free fast wireless in their airport. Spotless trains coming every five minutes and asking you to pay on the honor system.

New Site

Over the past year I’ve devoted myself to drupal development and a new site made in drupal has been long overdue.

This site is freshly built in Drupal 6 (currently in Release Candidate 1). It took about three hours to build (the majority of that was the design work) - Drupal 6 is even faster to set up than Drupal 5.

I plan to bring in the best of my music and comics from previous incarnations of my website, and also use this site as part random blog and part drupal-related work portfolio.

Syndicate content