RSS

Newsletter

The CodeKarate Newsletter is the best way for technical ninjas to keep their swords sharpened. Don't worry, we won't flood your inbox and your email address will always remain private.
Back to Top

shane's blog

Using the comment_driven_save function in the Comment Driven module

In the past at BEgINr Media, we used a heavily modified version of Open Atrium (a Drupal Distribution) for project management. One of the additions we added on our version of Open Atrium is the CaseTracker Plus Drupal Features module. This Drupal module uses the Driven API and Comment Driven modules to allow changes to the tasks while posting comments.

Select a Quicktabs default tab from the URL

If you have used the Quicktabs module, you know it is an easy way to displayed tabbed content on a Drupal site. However, I ran into the situation where I wanted to load a different default tab on a page. Quicktabs allows you to select the default tab to load, however in some circumstances it may be necessary to load a different tab by default (if a user is coming from another place on the site).

Jquery/Javascript method to handle real-time user input in a textfield

I recently ran across a problem where I needed to handle user input in a textfield in real-time. What I needed to do in my situation was to perform an AJAX call to my Drupal site as the user was typing into a textfield (to see if that value was available in the database). The main problem was that there were a few easy options for doing this in JQuery, but most of them were not good enough. Here are two of the options I tried.

Using the drupal_attributes function

The drupal_attributes function is a handy function (for Drupal 6 or Drupal 7) that allows you to easily add HTML attributes to your HTML output. For instance, lets say you wanted to output a simple HTML div with a few classes and an id. You could build a function like this to return the div:

Theming the Ubercart catalog page in Drupal 6

There are many ways to build a catalog of products in Ubercart. The simplest way is by using the uc_catalog module that comes with Ubercart. Other ways include building the catalog page with views, theming the taxonomy term pages, or for larger sites, using Apache Solr. In this post I am going to discuss the basics of theming the catalog pages that come with the uc_catalog module.

Pluralizing words in Drupal with format_plural

I frequently run into a common situation that I am sure many Drupal developers run into. For example, lets say I am printing out some text that has a number followed by a noun. An example might be 10 products. However, often times the number that you print out will be a variable. In this case everything is fine until you run into this situation 1 products. While this is more of an annoyance than anything, in the spirit of being grammatically correct, what it should say is 1 product.

Theming the Ubercart Product Page for Drupal 6

One thing that I struggled with initially was determining how to best theme the product page for Ubercart. Below is an example of what I use as a starting point when I begin theming an Ubercart product page. I usually take this and then add/remove the variables I need while adding the necessary HTML markup. Much of what I have comes from a post I found on the Ubercart website, but I have modified it to better fit my theme requirements. You can take this code and add it to your theme in a "node-product.tpl.php" file.

Hiding page titles for specific node types in Drupal 6

Occasionally you may need to hide a page title in Drupal 6 for a number of reasons. This can be especially useful if you are theming a node page and want to display the page title somewhere else in the node content. I often need to use this when theming Ubercart product pages. It is really very simple to do, just add this function to your template.php file inside your theme.

Drupal 6 user autocomplete search with images

I am sure most have used Drupal 6 autocomplete fields in some way. They are very handy for selecting/searching information. However, I recently wanted to take an autocomplete field and take it to the next level. Instead of just displaying text information, my goal was to create an autocomplete field in Drupal that would not only search the users on the site, but would also display their profile pictures next to the results. This technique is used on many social networking sites so I figured I would give it a shot. It turns out it is not really that difficult to do.

Drupal 6 confirm form example

There are many times when you will be developing a module that you will need to confirm an action. An example might include before deleting a piece of content, or changing the status of something. Here is a very simple example of how to create a confirmation form in a Drupal 6 module.

Syndicate content