Posts Tagged "Drupal"

The theming firehose (NB for designers & front-end developers new to Drupal) | rare pattern

You theme with the mark-up you have, not the mark-up you'd like to have.

That's the essential truth that designers and front-end developers new to Drupal need to understand. You don't get to construct your pages from scratch, building out essentials, never a wasted div, never an extraneous class. No, you have to flip the entire process around. With Drupal you're getting markup shot at you from a firehose, and as a themer you need to sop it all up and make it pretty. Don't spill a drop.

via The theming firehose (NB for designers & front-end developers new to Drupal) | rare pattern.

Drupal Best Practices : Use Theme Image Function to embed images

Often times, when you are themeing in Drupal, you may have to embed an image inside a template file. If the image is local, then it is best to use the theme_image theme function to embed it rather than using straight HTML tags. This not only makes your HTML output less error prone, but also automatically embeds height and width attributes to the tag. Embedding height and width attributes reduces the amount of repainting that the browser needs to do while rendering a webpage.

Here is sample code, which embeds a User’s Profile Picture.

<?php echo theme('image', $u->picture, $u->name, $u->name, array('class' => 'content_img')); ?>