Codekarate Content

By shane
Wed, 2011-08-03 14:01

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.

By shane
Thu, 2011-07-28 10:21

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:

By shane
Wed, 2011-07-27 08:50

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.

By shane
Mon, 2011-07-18 09:08

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.

By shane
Tue, 2011-07-12 15:39

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.

By adam
Tue, 2011-07-12 14:33

This is a guest post from Adam, my Co-founder at BEgINr Media

Here is a simple way to make a background image resize correctly on different screen resolutions.

The image that I used was originally sized 1011px X 249px. For this tutorial I broke the image
into three different sections. See diagram below for more information.

By shane
Tue, 2011-07-12 10:39

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.

By shane
Fri, 2011-07-08 19:10

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.

By shane
Tue, 2011-06-28 20:50

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.

By shane
Tue, 2011-06-28 15:33

Here is a way to get the Vote Up Down module to display the voting widget inside a Node View panel. Most of this code has been borrowed from http://drupal.org/node/476746#comment-3650194. While the drupal.org post contains most of the necessary code, there was no simple walkthrough on how to actually implement it.

Lets start out with a new module called vudwidget. Go ahead and create the vudwidget folder and the vudwidget.info file with the following contents.

Pages