Invoke Drupal #ajax element via JavaScript / jQuery

You can easily invoke a Drupal 7 form element's #ajax callback via JavaScript, you just have to know how to trigger the binding properly. If you look at the inline JavaScript that Drupal prints on your form's page, you'll see local Drupal settings as well as ajax settings to be used on the current page. Here's an example:

Using Drupal data, functions, and session variables in an external PHP script

Just a quick post to save anyone else that runs into this. If you've created something like ajax.php to handle some minor requests outside of your primary Drupal install but you need access to things like the $user object or the PHP $_SESSION variables, you can simply bootstrap Drupal at the top of ajax.php as you need:

Drupal module: Webform Roster

I put together a small module for a recent project that extends Webform to include a "roster" form. Basically, you can assign Webform B to be the roster form for Webform A. When a user completes Webform A they're sent a link to complete Webform B. This link can be used an infinite number of times, so the original user could fill out Webform B immediately, or send the link to a dozen others (which is what my needs are). All of the Webform B submissions are tied to the original Webform A's submission, and show up when viewing that original submission.

Make a Drupal image gallery without using modules

I can't stand the over-use of contrib modules when they just aren't necessary. When a visitor loads your Drupal front page, all of your modules are opened and read by the server whether they affect the front page or not. PHP searches files for hooks that need to be fired, a huge number of database requests are made that don't necessarily have a purpose, and on the list goes. Why use modules that perform tasks already available to you such as including a JS library in your theme's folder, firing a trigger/action when a user logs in, or building your own custom content type?


Anatomy of a Drupal Theme - Basic Structure

It can be a bit confusing to create a custom theme for Drupal. Users new to this process typically hack a core theme like Garland, or grab a starting theme from the repository, but then it's easy to get frustrated with all the different template files, functions, and styles. After all, what are these extra functions? Why aren't they included in Drupal's core if they're so necessary? Why do I see page.tpl.php and a bunch of node-*.tpl.php files and a dozen other .php and misc files? I'll try to cover some of the basic concepts of Drupal theming and get into the more advanced stuff in later posts. My goal here is to really break things down on a simple, linear level.

Anatomy of a Drupal Theme - The Node Object

The function behind the $node object is node_load(). This brings the $node object into play within your node.tpl.php template file and gives you the ability to display any variables from the node. Drupal handles everything behind the scenes -- access permissions, attached taxonomy, attached files, meta information, and more -- and hands you the gift wrapped object. In addition to the core variables, the node object also includes any added variables, such as CCK fields. 

10 Free Drupal Themes That Don't Suck

I hear complaints in the community that many of the core and other free themes that are available for Drupal are too stock looking. While a lot of them tend to leave aesthetics at the door (and there are reasons for this) there are also some great free themes available. Here's a handful that I have turned to, either to build upon or use as-is for small sites:

Acronis uses Drupal for their Knowledge Base

It's always cool to see large organizations implement Drupal. Acronis (software vendor specializing in backup and disk utility apps) has leveraged the power of Drupal's core node and taxonomy systems, as well as powerful modules like webform, to provide their community with an intuitive, simple, and well-mapped system -- at a fraction of what it would cost them to have built it from scratch.

Check it out at http://kb.acronis.com/

Limit "Ship To" States in Ubercart

The steps below will allow you to restrict the US States that a user can pick from when checking out in Ubercart. This was useful for me when a client needed to restrict shipping bottles of wine to various states that don't allow that sort of thing.

Source: http://www.ubercart.org/forum/support/11620/limit_us_states_list_48_cont...

Recommended Drupal Modules for an Ideal Base Package

I'm sure there are great arguments for starting out with nothing but core modules, and I'm sure there are even better arguments for every installation having all 32 of your favorites. This post, however, will outline a handful of modules to extend a basic Drupal 6 package into something that ought to have everything a client's website will need. The final package will  include hands-free SEO, dynamic blogging capabilities, search engine (and eye) friendly URLs, and a handful of other bonus features.

- Core Distro of Drupal 6

Subscribe to RSS - Drupal