Drupal Development Update

This article describes my efforts this weekend to build out a new Drupal site. I post it here as a record to myself, a resource for others, and a request for feedback from more experienced Drupal developers.

I built out a new Drupal site this weekend, a clone of a server-side include site that I launched a few years ago. The company, run by friends, wants to provide more direct insight into their trips through blog posts and photo galleries. Using Drupal may also prepare us for the next step beyond that, the development of an online community on the site for guides and customers. For me, I appreciated taking the next step in my knowledge of Drupal, moving beyond my intranet experience of last year to the public face of a small business. I also remain impressed with Drupal’s power and versatility. One can build so many different kinds of sites with Drupal, yet enough depth/specialization exists to do the job right no matter what the task. Amazing.

sample pic

I took two tries to get the theme mostly right. I find it challenging to merge the CSS styles of the original site with the built-in Drupal ones. It has helped a lot to start with a simpler theme (this time, Chameleon) than a richer one with more to correct. I still find CSS styling nonintuitive, what with the different techniques used to embed CSS styles in div, span, p, a, ul, and li tags.



I finally gained some understanding of how theme regions work. I saw first-hand for the first time region definitions inside a theme and began to clue in that I can place a region wherever I like on the page, create a new block with content specific to that region, and then only display the content on one or more pages that I want. For example, I currently have weather (using the plugin of the same name) loading in the right-hand column. I want to eventually display it in the main content area but mix it with other, editable content there.

Displaying Perl Output
I didn’t want to rewrite the Perl components of the reservations, calendaring, and book order system, so I went looking for a way to display Perl output within Drupal. I found a neat JavaScript trick but took a while longer to determine that each document.write instance in Perl had to output a single line of code — no line breaks. In the end, it worked — JavaScript calls the Perl script from a Drupal block, which chugs through its operations and then returns the HTML to Drupal using document.write.

Image Galleries
For image galleries, I have before tried image_gallery and embedded Menalto Gallery. Both have had their downsides. This time, I used image_gallery but laid Lightbox v2 on top, and boy does it look great. I also wanted to give Flash Gallery a shot, but it died with script errors during install. For this client, FTP transfers of files to the remote host will be fine, but eventually I would like to implement something like Image Publishing in order to uploads dozens or hundreds of images at a time into Drupal, as Gallery does so effectively.

Lightbox v2

PHP Memory Limit
PHP memory limit is giving me a hard time. Currently, I can only upload photo gallery images of less than 100kb without producing “out of memory” errors. This happens no matter whether I use image_import or create content->image to upload the image. I suspect that our web host may restrict PHP to 16MB. I have run into errors trying to push their config any higher. I am using every module I have installed, so reducing overhead doesn’t look promising.

memory error

Taxonomy and Content Types
It took me a good while to understand how Taxonomy (Categories) works when I first started with Drupal just over a year ago. Now, I have barely proficient, at least enough to determine a strategy for how to organize trips in this site. Using the Content Construction Kit (CCK) and Taxonomy, I will have created three new content types (trip, itinerary, and equipment list) and a taxonomy called “trip type.” I can now produce lists of trips for each category, which I will next link to their related itineraries and equipment lists. Having each trip be a separate node will also allow us to open comment-based dialogue about the trips.

Preserving Referring Links
I am going to edit the .htaccess file to automatically remove .shtml for any old-style requests. As long as I follow a similar naming convention in Drupal as I did with the old HTML pages, we won’t lose links from referring sites when the Drupal-based one launches.

Unexpected Line Breaks
As I migrated trip descriptions from the old site to the new, I encountered bizarre line breaks where I didn’t expect them. Turns out that I found a slight conflict between TinyMCE and Drupal’s automatic line breaks. Though it sounds counterintuitive, it seems that one must disable line breaks in the Drupal input type definitions in order to avoid these unwanted line breaks. TinyMCE handles the conversion of line breaks into HTML tags on its own.



The weather module works great. What a gift. And to think that, two years ago, I gave up on a Perl-based weather solution I was trying to install on this site.

Integrated New Features
Our friends at the guiding company will have to think about how much home page real estate they want to give to the blog and image galleries. Right now, the two new features they want are buried. It’s not easy to shove the introductory content aside in favor of more specific, time-sensitive material.

Temporary Files Location
The temporary directory setting in File System died quietly, without Drupal error. On this shared hosting system, I moved the temporary directory to within the Drupal file system, and now it works fine. In other words, don’t use /tmp.

File Storage
I originally wanted to be rigorous and keep the Drupal file storage system outside of the public HTML directory, even though I don’t yet have any private files to store there. It worked great while logged in as admin but not for an anonymous user. For example, photo gallery images would silently not display for anonymous users, despite the proper permissions settings. This appears to have something to do with anonymous users not being able to access scripts in system/. I migrated the file store to the public web directory, and now it works fine. I will eventually need to figure this out for other sites.

Additional Modules Installed
Lightbox v2

Optional Core Modules Enabled

One comment

  1. memory says:

    I have seen an improvement in my memory after doing some mind exercises on a daily basis. Do check out http://www.photographic-mem…, it helped me and it can definitely help you too.