Code & Writing Samples
If Drupal is "free", what are professional Drupal development budgets based on?
With Drupal being an open source software and having such a great set of features right out-of-the-box, people may wonder what they pay for when going to an expert Drupal developer or shop for their Drupal install.
A good Drupal site may cost thousands of dollars. For an enterprise level site the budget may be in the hundreds of thousands of dollars. What’s that all about? I thought Drupal was “free”. The following is a bit of explanation.
Most web site features are already built into Drupal and ready to be configured. With professional Drupal development you are not paying for features, but rather expertise. What expertise?
Professional Drupal developers and shops offer expertise in Drupal site:
- branding and visual design
- theming (to be defined below),
- feature integration,
- architecture,
- scaling,
- optimization,
- and security.
What are professional Drupal development budgets based on?
Not Just Features
As Drupal’s base install already has a large feature set which will meet many site’s needs, it is important to note that there are actually very little features lost or gained at budget levels past a certain point (the cost of install, setup, and deployment). What budget levels do affect, that is, what is lost or gained are levels of feature integration (interaction) and design implementation (theming).
Theming
To meet real business branding and marketing objectives, companies need their professional visual design developed into Drupal in a way that effectively and successfully communicates their brand.
What are the best practices for rendering different types of node displays?
The following post is an answer I wrote to a question submitted to Tree House Agency in preparation for Do It With Drupal (New Orleans 2008). Tree House has kindly given me permission to post this material on my own website.
Q: One node, varied displays?
BH asks:
What are the best practices for rendering different types of node displays?
Short Answer
Three methods immediately come to mind. These are:
1. Different TPL files for each type of node
2. Switching template files by path
3. Using CSS to change display by node type
Additional cases may include:
4. Switching by taxonomy term
5. Switching by role type
6. Switching by user id
Details
1. Different TPL files for each type of node
Drupal already has an excellent built in method for rendering different types of node displays.
Grab a copy of node.tpl.php from Drupal’s modules/node/ directory.
![clip_image002[8] clip_image002[8]](http://www.seanbuscay.com/sites/default/files/clip_image002%5B8%5D_eb42d4ce-7e4a-4a8f-845b-511bc02c8f31.jpg)
Put it into your site theme folder. Then rename it according to whatever node type you would like to customize. (node-nodetype.tpl.php )
Notes:
The node type should be the machine readable content type.
There are many places to find the machine readable name. One place is at: /admin/content/types
Dev snapshot of a CMS I wrote
The following are samples of database work I have done. I have attached a sql file as a sample. It is a dev snapshot of a CMS I wrote.
So you don’t have to just stare at sql statements, I have highlighted some points in this post. I will paste sections of the sql statements and then comment on them.
More about my theme for SeanBuscay.com.
I built a Drupal theme I call “chi”. It is based on the Yahoo! YUI Grids CSS foundation. Like the excellent “Zen” theme already written for Drupal, a Drupal theme based on Yahoo! grids CSS can offer an excellent starter theme for Drupal developers and themers.
I recently posted a summary on the benefits of YUI Grids CSS for Drupal theme developers on my blog. You can view it as a screencast, PowerPoint presentation, read a text summary, or download a PDF from this URL:
http://seanbuscay.com/drupal-web-development/yahoo-ui-library-grids-css-drupal-themers
I have included a zip file of the theme code at the end of this post for you to review.
I’ll highlight a few sections of the code and features in the screen shots below.
First, this is a Drupal 6 theme, which utilizes an .info files for themes. A number of theme elements can now be defined within a simple text based .info file rather than within the code of a template.php file. Here’s a screenshot of the included chi.info file.
Note that regions and theme style sheets may be defined in the theme.info file. One important catch is to define the CSS files in the order in which you would like them to load. They are like defining an array in PHP or Java. So, when including a file sheet which resets all fonts and html elements to a base starting point, and then including a style sheet which builds upon that base reset, the load order needs to be considered.
Building a Publishing Workflow with Scheduled Transitions at Node Creation
Introduction
The Need
Our clients and other Drupal site administrators would like to use the Workflow module to schedule transition states in their publishing workflow.
The Problem
Currently, within the Workflow module a node cannot be assigned a scheduled state change upon node creation. A node must be saved first, then edited a second time by the user.
After reading this comment in the Workflow module issue que: http://drupal.org/node/189572#comment-704334 I decided to try to add a little more automation to the process of creating a node and adding a scheduled state change.
In this Post
You’ll learn how to create a publishing workflow for your website, and how to improve the process of scheduling a transition change during node creation.
Let’s begin.
Note: This demonstration is build on Drupal 6. The process outlined below may be adapted for Drupal 5 install.
Install and Enable the Necessary Modules
1. Download, install, and enable the necessary third-party modules
o Workflow - http://drupal.org/project/workflow
o Token - http://drupal.org/project/token
o Token actions (part of Token module)
2. Enable Drupal’s core Trigger module @ /admin/build/modules
Set Your Permission Settings
Allow at least one user role a permission to schedule workflow transitions @ /admin/user/permissions#module-workflow
Free Tagging from Windows Live Writer to Drupal
Allowing Tags to be Added in the Post Body Text
Free Tagging when the Blog API Does Not Support It
The following is a quick code sample showing the start of a Drupal module which lets a user add new tags to a post by placing the tags in the body of the post in a format like so:
[tags]blog, blog api, blogging, Drupal 6, weblog, windows live writer, wlw[/tags]
Use Case
I’m only using code like this for one use case. It’s for clients who do a lot of editing and posting of their Drupal content through Windows Live Writer.
With Windows Live Writer and Drupal, my clients use the “Movable Type API”. Without extending the API, it does not yet support adding new vocabulary terms. Thus, from Windows Live Writer to Drupal sites, one can only tag content with existing terms. This code allows new tags to be added.
The terms are added to a specified vocabulary id and associated with the new or updated content node.
The inline tags are removed from the body of the text before insert or update.
Inline Tags Sample Module Code
/**
* Module implementing Drupal's hook_nodeapi
* @see http://api.drupal.org/api/function/hook_nodeapi/6
* Important Note: This is sample code.
Yahoo! UI Library: Grids CSS for Drupal Themers
-
What's YUI Grids CSS and what are its benefits?
-
What's in the library?
-
How do we use it?
Note: The sound quality on the low res version is somewhat poor. You may want to watch the High Res QuickTime Movie, or just download the PDF to view.
When to use jQuery on your site (jQuery Mini-series Part 1 of 3)
Use jQuery to Enhance Site UI, Display, or Interaction
jQuery is an excellent tool for improving your site’s interface. It’s also helpful to target and change specific CSS and HTML elements quickly. [1]
I tend to use it mostly for UI (user interface) enhancements or when there is a semi-dynamic event in the display, after the page has loaded.
Examples uses include:
- User feedback in messages
- Tool tips (in-context user guidance)
- Enhanced image/gallery display
- Tabs for quick access to hidden information
- As a style sheet switcher (helpful with accessibility)
- Form enhancements and client-side feedback
- Menu enhancements
- Data entry such as a date picker
- Table and data sorting
- Media players
- Content flagging
- Tagging (better input methods)
- Loading additional content without a page refresh
- Dynamic Charts
- Content Carousels (albums, photos, headline news stories)
Do Not Use jQuery as the Primary Driver for Site UI, Display, or Interaction
jQuery should not be used as the primary driver of your site’s display and not as a cornerstone of any primary functionality for your site.
In other words, sure, enhance your web sites e-commerce process with jQuery, but have it:
- degrade gracefully,
- making sure people may still go through the e-commerce process,
- even if jQuery fails completely.
Simple uses can have big impact
When consider the rendering of display effects such as rounded corners and color gradients, consider CSS instead.