Drupal 7 Development

I’m continuing my somewhat slow attempt to become a Drupal expert. After finishing up a couple of general Drupal books from Packt, I started “Drupal 7 Module Development,” also from Packt. I got up to chapter four, then put it down in frustration. I’ll likely pick it up again, but it’s not an easy book to read straight through, with little prior Drupal dev experience.

So, then I picked up “Pro Drupal 7 for Windows Developers,” and I’m doing much better with that one. I just finished chapter 5, which walks you through the creation of a simple, but non-trivial, module. I found it fairly easy to follow, and a good start. The book is (obviously) written for Windows programmers looking to learn Drupal, specifically ASP.NET developers, so it’s a good fit for me.

There’s still a lot more to learn. Drupal’s API and hook system are fairly complex and extensive. But I think I’m on the right path.

PHP IDEs

Since I’m doing more and more PHP development, I’ve been spending a bit of time trying to figure out if I can put together a decent development and debugging environment. Up until now, I’ve just been using Notepad++ (on the PC) and TextMate (on the Mac).

I’ve switched over to Komodo Edit on both platforms now, and that works pretty well. To do debugging, you need to spend $300 on Komodo IDE. But Komodo Edit does a lot, including auto-completion, syntax checking, and the ability to drill down into function definitions.

I like the idea of having a debugger, of course, so I decided to explore a couple of free IDEs that would support that. Netbeans looks nice, but it’s pretty heavy. Eclipse PDT is a bit better, but still kind of bloated. I think I may have to spend the $300 on Komodo IDE.

Drupal 7 on Windows

I have a fairly reasonable “WIMP” stack (Windows, IIS, MySQL, PHP) running on my work machine now, and I wanted to document how I got there, for future reference, or for anyone who might stumble across this blog post. My setup has evolved over time, so I’m not 100% sure if these instructions would work exactly right from scratch.

There are some ways to get a Drupal-compatible “WAMP” stack (Windows, Apache, MySQL, PHP) running on Windows pretty quickly, but most of the stuff you really need to do in Drupal works OK in IIS. And I think that the approach I outline below gives you the most flexibility in terms of also using the components for stuff other than Drupal.

In these instructions, I’m creating a Drupal site named “drupal-7-test”, but it doesn’t really matter what you call it.

  1. Get Web Platform Installer from http://www.microsoft.com/web/platform/.
  2. Use Web Platform Installer to install “IIS 7 Recommended Configuration.” You may also need to install URL Rewrite if you don’t already have it.
  3. Install MySQL via the MySQL Installer for Windows. (Do not use Web PI.) Select “developer default” to get the MySQL Server, Workbench, and a few other useful things. For configuration, select “developer machine.”
  4. Install PHP 5.3.x from http://www.microsoft.com/web/platform/phponwindows.aspx with Web PI. (This will pull in a few other necessary components.) (Do not install the PHP for WebMatrix — click the link on the above page.) (Oh, and the page still says “PHP 5.3.5,” though the actual installer has been updated to a more recent version.)
  5. In IIS Manager, go to “default web site” and click “PHP Manager”. Make a note of the location of the config file and the error log. Click “configure error reporting” and select “Development machine”. Click Apply.
  6. Get phpMyAdmin from http://www.phpmyadmin.net and unzip it to c:inetpubwwwrootphpmyadmin. Go to http://localhost/phpmyadmin and run through the setup.
  7. In phpMyAdmin, create a user named “drupal_7_test”. Click the checkbox to also create a database of the same name, and give that user all rights to it.
  8. Get Drupal 7 from http://drupal.org/download and unzip it to c:inetpubwwwrootdrupal-7-test. (The standard Drupal 7 download includes a web.config that enables clean URLs for IIS, given the MS IIS Rewrite module.)
  9. Give IIS_IUSRS modify rights to sites/default/files.
  10. Go to http://localhost/drupal-7-test and run through the setup. Use the MySQL database & user created earlier.
  11. Go to the status report in the Drupal admin and check that everything is working OK.

Random follow-up notes
It’s June 10, and I’m setting up a WIMP environment on my ThinkPad. I’ve also recently set up a WIMP environment on my new work desktop, so I’ve got a few follow-up notes on this post.

  • You may need to enable CGI on your machine, if it’s not already enabled, to get PHP working. See here for details.
  • As an alternative to the full MySQL installer I linked to above, you can also use the stripped-down version that can be found here.

another Drupal 7 book

I just finished reading Drupal 7 Business Solutions, by Trevor James, a Drupal e-book that I got from Packt. I finished another Drupal e-book, titled simply Drupal 7, by David Mercer, about a month ago. The one I just finished goes over a lot of the same ground as the Mercer book, but I think it was still worth reading. The author uses a web site for a bread bakery as an example throughout the book, adding functionality to the site to demonstrate various features of Drupal. It’s full of functional, quasi-real-world examples. I think it would be very helpful to anyone looking to get a good grounding in Drupal basics.

I mentioned some time ago that I was working on a new documentation site, in Drupal, for the REST API to my company’s product Bullseye. That site is now in production, and you can see it at http://api.bullseyelocations.com/. It’s a simple enough site, but I think it turned out well. I’m using the “book” module to organize the content, the CKEditor module to allow me to easily enter nicely-formatted text, and the GeSHi Filter module to format source code examples.

I’m still not great at the theming stuff, so I just created a fairly simple sub-theme of Bartik for this site. The only really major thing I did with it was to change it to use a Google font (Droid Sans, which is what we’re using on our new marketing site for the product). I think it looks pretty good.

(And yes, I wrote nearly all of this documentation myself. To a large extent, it’s based on the documentation for our old SOAP API, but it’s evolved enough that I think it’s mostly mine now.)

Linux

I decided to spend a little time today installing Ubuntu 11.10 on my old Dell Inspiron laptop.

It’s been a while since I messed around with Linux.  Just for yuks, I went back and looked at some old notes and posts to see if I could piece together my history with Linux. I think the first Linux distro I ever used was this old one, which I think came on two 5 1/4″ floppies. That probably would have been in 1993. I had wanted to get some Unix experience, since the company I was working for at the time was being purchased by a company that used some flavor of Unix on the back-end, so I wanted to be prepared for that. (In the end, I didn’t stick around for too long, so it didn’t matter much anyway.)

Past that, I remember using Red Hat 5, so that would have been 1997, and Corel Linux, probably in 2000. And I used various versions of Fedora at my previous job, for various purposes. And I can see that I was messing around with Ubuntu back in 2007.

The Ubuntu install finished up while I was typing this, and it looks like everything worked. In the past, any Linux install I did on a laptop would usually have at least one minor problem, either with video, audio, or networking. But so far, it looks like this one is fine. Now I need to sit down with this machine and see if I can get Apache, PHP, and MySQL all running, so I can mess around with Drupal in a Linux environment.

Computer Books

After finishing the Drupal 7 book I bought a few weeks ago, I decided, for some reason, to get back to a book that I bought back in April 2010 — Dino Esposito’s “Introducing Microsoft ASP.NET AJAX.” I started reading it not long after I bought it, but I put it down after reading the first few chapters and just never got back to it. It’s somewhat out of date now, but it’s still got some useful info in it.

I just finished the chapter on the Ajax Control Toolkit. Now, I’ve been using the ACT a lot at my current job, but it turns out there are several controls and extenders in there that could be pretty useful, and of which I was completely unaware. I’ve tended towards doing client-side stuff with jQuery, like pretty much every other web developer on the planet, but there are times where I think the ACT could have made things easier.

creating an API documentation site in Drupal

Part of my job involves maintaining the REST API for a product called Bullseye. It’s an evolving API, and we’ve always kept the documentation in a Word file, which we simply print to PDF and publish to our web site. But, it seems kind of silly not to have a real on-line documentation site, so I started working on one recently. I’m using the book module in Drupal, along with CKEditor and GeSHi. Right now, I’m simply going through the Word doc, and pasting stuff into Drupal nodes using the “paste from Word” function in CKEditor. I’ve been pleasantly surprised at how well that works. The HTML that results usually looks pretty clean. For code samples, I just decorate them with the GeSHi tags and that does a pretty good job. I want to mess with the font settings in GeSHi a bit, but other than that, I like it.

At some point, I’m going to want to see how I can go in and hyperlink related classes and methods, and stuff like that. I’m hoping I can find a way to do that automatically, rather than having to go in and manually create a bunch of hyperlinks.

DrupalCamp NJ

I haven’t blogged in a couple of weeks, so I thought I’d throw a quick post up. I’ve been busy with some personal stuff, listing my parents’ old house with a new real estate agent and lowering the price. I did some cleaning too, but there’s still a lot I could do to make the place look nicer and hopefully more attractive to potential buyers. We’ll see how much of that I manage to get done.

I’m still working on learning Drupal. I’ve worked my way through most of the Drupal 7 book that I started a couple of weeks ago. I want to finish that, and then maybe start into learning module development. And I just registered for DrupalCamp NJ, on Feb 4, at Princeton. That should be interesting.

Drupal 7

This is one of the books I bought in ebook format from Packt last week. It’s a beginner/intermediate level book on Drupal 7, covering installation, configuration, and administration. It covers all of the basics (as far as I can tell) along with some of the more interesting parts. I’m about halfway through it. I find that I’m skimming over parts of it, since some aspects of Drupal are pretty obvious, if you’ve ever used a CMS before.
The formatting of the epub file, which I’m reading on my iPad, leaves a bit to be desired. I’m pretty sure that some special characters were lost in translation somewhere. There are a lot of places where there should probably have been an em-dash, and there is no em-dash, for instance. And I just came across a table that got screwed up so the text that should have been in the second column is instead just superimposed over the text that should have been in the first column. (The PDF file for the book looks fine though.)
I think I’ve been spoiled by O’Reilly’s ebooks. They generally have accurate and reasonable formatting for their PDF, epub, and mobi files.

Drupal 7 clean URLs

I have today off from work, so I’ve been sitting around at home, messing with Drupal.
I couldn’t quite figure out how to get clean URLs to work, until I stumbled across this article. (See the “post-installation tips” section at the end.) Pretty simple really, and I should have been able to figure it out on my own, if I’d read as far as the RewriteBase section of the main clean URLs article on drupal.org.

I also went a bit nuts at www.packtpub.com today. They are running a special, 5 ebooks for $60, so I bought four Drupal books and one PHP book. I’m building up a bit of a library of ebooks that I’ve bought on sale, mostly from O’Reilly.  I never seem to have time to read them though!