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 Install: Configuring Apache

Drupal

I plan to create Drupal video tutorials in the near future. Although I use a Mac as my primary development box, I have Adobe Captivate installed on my Windows PC. So I installed Drupal on my PC and I ran into problems that required Apache configuration changes.

index of/

The Problem: When I clicked on the ‘Administer’ link on my site’s home page, ‘index of/‘ and a list of my site files and directories displayed instead of the administration page. In fact, any page that I attempted to go to resulted in this ‘index of/’ display.

The Solution: I opened the Apache configuration file (httpd.conf) and found that the Allowoverride for .htaccess files was set to None. I set Allowoverride to All and restarted Apache.

Clean URLs

The Problem: I always enable Clean URLs, but for some reason, I was unable to on my PC.

The Solution: I again opened my httpd.conf file and found that Apache’s mod_rewrite module was not enabled (this must be enabled in order to use Clean URLs). So I uncommented the line that loads the module and restarted Apache.

Now Drupal is running perfectly on my PC. I was a bit surprised that I had not configured Apache prior to this, but I guess that I use my Mac (and Ubuntu) so much that I never found the need. Enjoy.

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