Drupal: Adding an component to existing Feature using Drush

Drupal, PHP

On a recent Drupal (link) project, I installed the Environment Indicator module (link). One of the great aspects of this module is that it integrates with the Features (link) module. After featurizing the module’s configuration, I decided that I also wanted the feature to include the user permissions. I found that there are multiple ways to add a component to an existing feature.

Continue reading

Checkout My New Site - T-shirts For Geeks

Drupal: Dependent dropdowns with jQuery

Ajax, Drupal, Javascript, JQuery, PHP

I have told my co-workers on many occasions that Drupal doesn’t do true Ajax. With true Ajax, elements change without a page refresh and only the relevant elements are affected. With Drupal, the elements change because the entire form is refreshed. For instance, if you use Drupal’s Ajax to make the values of one dropdown dependent upon the selected value of another, the entire form has to be refreshed in order for the second dropdown to be updated (See Ajax Example: Dependent Dropdown). Although, there are times when I do use Drupal’s Ajax in this scenario, I much prefer to use jQuery.

Continue reading

Checkout My New Site - T-shirts For Geeks

Drupal: Using the Features API in Your Module

Drupal, PHP

Although, I have not written many posts about Drupal, I have actually worked more with Drupal over the last 4-5 year than any other web technology (except for jQuery). I recently created a module to control the display of a content type’s fields based upon roles (node add/edit). I created an import/export of the modules settings so that each environment (development, test, production) could be easily updated. The problem is that import/export is such a manual process that it was often overlooked during a deployment. So I decided to use the Features API to featurize my module’s settings.

Continue reading

Checkout My New Site - T-shirts For Geeks

Using Zend Framework with Drupal

Drupal, PHP, Zend Framework

I have been using ExpressionEngine and Zend Framework on my current project. We recently migrated the cms to Drupal (see migration), but we wanted to keep the Zend Framework apps. Most of the content of the website is handled by Drupal 7 (link), but certain urls on the website are handled by Zend Framework. On the Zend pages, I removed all layout information so that it is controlled by the Drupal theme.

Continue reading

Checkout My New Site - T-shirts For Geeks

Migrating ExpressionEngine to Drupal 7

Drupal

I’ve been using ExpressionEngine on a project for almost two years. Although the end-users of the company like ExpressionEngine, my boss has never liked it and has wanted to move to Drupal for quite some time. We finally go the chance with the start of a new project. I have created websites using Drupal 6, but that was quite a few years ago. Now I was tasked with migrating ExpressionEngine 1.68 to Drupal 7. The entire script can be found on GitHub. Although the script is specific to ExpressionEngine, the steps required for migration can be used to migrate any content management system to Drupal.

Continue reading

Checkout My New Site - T-shirts For Geeks

Drupal, JQuery: Dropdown Menus

Ajax, Drupal, JQuery

I needed to add Dropdown menus to a site that a designed using Drupal. I found a few modules (Nice Menus, etc) that would enable me to easily add dropdown menus to my site, but I wanted to use the CSS Drop-Down Menu Framework that I discussed in a previous post. With a little help from JQuery, I was able to add dropdown menus to my site without having to use a Drupal module.

Continue reading

Checkout My New Site - T-shirts For Geeks

Relative Image Paths in Drupal

Drupal

I’m working on a project that uses Drupal and I wanted to add a few images to the home page.

First I created the folders files/images under the root directory. I then created the home page (Create Content->Page). When adding images to the home page, the file location is relative to the root directory:

<img src="files/images/flash1.jpg" width="168" height="112" class="imageFloatLeft">

But when I created another Drupal page (a page other than the home page), the relative path for the image is different:

<img src="../files/images/flash1.jpg" width="168" height="112" class="imageFloatLeft">

And when I created a page using Drupal’s Panels Module, the relative path for the image is once again relative to the root directory:

<img src="files/images/flash1.jpg" width="168" height="112" class="imageFloatLeft">

Adding content to Drupal seems to be fairly straightforward, but I did struggle a bit as I tried to figure out the relative paths of images/files so I hope this helps anyone else who may be struggling.

Checkout My New Site - T-shirts For Geeks

Learning Drupal – Step 1: Themes

Drupal, Pebblet, PHP

I have been a PHP developer for many years and I have recently started learning Drupal 6. I struggled for a few days just trying to modify one of the existing themes. If any of you are just starting to learn Drupal and you want to create your own design/theme, I found that the easiest way is to first create your design template (HTML and CSS) without the PHP/Drupal code. Once your design is complete and can be viewed correctly in the modern browsers, then  open up one the themes (page.tpl.php) that are installed with Drupal and copy/paste the revelant PHP code into your template. I also use this approach when I create WordPress themes.

Before you begin your design, make sure that you have a fairly good understanding of Drupal’s Regions, Blocks and Modules and Blocks (Blocks are placed into Regions). Namely, header, left side, right side, and footer. You don’t necessarily have to use all regions in your design (i.e., you may not need a right side), but you should have a good understanding of what each region can be used for.

When I created my first Drupal theme, I did not think that I needed a right side, so I did not create one. But after I looked at other websites that use Drupal (and the many contributed modules), I found some very good content ideas that can be placed on the right side of my Drupal theme template.

I will, from time-to-time, post other Drupal tidbits (as I learn them).

Checkout My New Site - T-shirts For Geeks