css

Adding Module Stylesheets using drupal_add_css()

A couple days ago, when building a quick site with limited functionality (basically a pretty front end to a database website), I ran into a hiccup with my custom module/theme for the site, which caused me to scratch my head for a few minutes.

In my custom module (called 'idcards'), I added a stylesheet for a couple forms on the site using the drupal_add_css() function:

/**
 * Implementation of drupal_add_css()
 */
drupal_add_css(drupal_get_path('module', 'idcards') .'/idcards.css');

Later on in the development, I added a custom theme (based off a Zen subtheme I use for many smaller sites), and in that custom theme's .info file, I added a stylesheet named idcards.css.

When I cleared all the caches, I noticed the custom form styling (added by the module's idcards.css file) was missing, and on further investigation, I found that the module's idcards.css file was not being added to the pages!

Let's Get Through the PHPTemplates!

I just finished rolling a patch for fixing node.tpl.php in Drupal 7 over on the Drupal.org issue queue; hopefully it's ready to be rolled into core, as it's been weeks months since that particular issue was started. Page.tpl.php is already complete. We still have a few more to go, including comment.tpl.php, block.tpl.php and a bunch of little .tpl.php files.

I think Drupal 7 is going to be the best release of Drupal yet, in terms of being able to have a lot of appeal to non-programmers/techies. I set up my first ever full-fledged Wordpress site a few days ago, and it was super-easy to get things going (although also severely limited in what it could do, compared to a base Drupal install with Views and CCK), choose a new theme, change some settings, and hit the ground running.

Closer, Ever Closer, to Pure-CSS Bliss in Drupal

Today I contributed my first 'original' piece of content to Drupal: a handbook page entitled Create a CSS-Only Theme. Since the first time I heard about the Stark theme (a Drupal theme which does nothing but expose all the 'stark' html output of Drupal core), I've been thinking of ways to enable designers to quickly build out unique and beautiful themes for Drupal. In Drupal 7, I think this will be a reality. (And maybe, just maybe, I'll create a theme for inclusion with Drupal 7 in the next few months).

W3C Validation & Why You Should Use It

Whenever you're designing a website, one of your primary goals, besides communicating the mission of the organization for whom the website is being made, should be to make the website accessible to all visitors, no matter what kind of computer or browser they have, and no matter what kind of disabilities they have (whether it be blindness, deafness, or other problems).

Luckily for you, there's a free and easy-to-use tool on the web that lets you check how well your website conforms to coding standards:

W3C Markup Validation Service Banner

The W3C generously provides this service to further their mission of having an open, accessible and free web. The tool is dead simple to use: just type in your website's URL, and click Validate. Errors will then show up, and you can go back to your source code and fix the little mistakes you've made. But there's a lot more about Validation that needs to be said!

Adapting Your Website for the iPhone

iPhone Safari Icon

In the past year, I have seen more and more mobile visitors to some of the websites I maintain, and the lion's share of those mobile visitors are using Safari on the iPhone or iPod Touch. A few of the sites receive more than 5% of their visits from such devices. For those sites, I thought it would be fitting to give them a little better mobile treatment, optimizing the layout for the iPhone.