Saturday, March 21, 2009

How to update the feeds on my Drupal-based web site

My web site,, displays blog entries from two blogs right now:
I'm using a Feed Aggregator module in Drupal to tell it to pick up blog entries and display them on the front page of the web site.

But Drupal doesn't automatically pick up new entries; you have to tell Drupal to go out and check for new entries every once in a while. In the Unix world, that kind of periodic activity is usually known as a cron task, something you would tell the "cron" program to run from time to time.

I currently host my Drupal site on; there is a nice, easy way to have GoDaddy run the cron task as often as you'd like, and it'll wake up Drupal and get Drupal to update all the feeds it receives.

For simple instructions on how to configure the GoDaddy cron service, look at this web page. It's simple and complete; it tells it all.

Sunday, March 15, 2009

How to push a simple Drupal web site from test to production

I decided to give up on the twitter issue for now (I've been trying to get tweets onto my Drupal web site but couldn't make it work right). So I decided to go with what I have, which is my basic web pages + my Transcode blog showing up on the Drupal-created web site's main page.

My next task was to try to push the web site live, onto my hosted web server. I had to learn how to create a MySQL database on the hosting company, which was easy to do but took a couple of hours to show up. I also wanted ssh access to my site, which apparently caused my hosting company to move my hosted environment to a different server; that also took a few hours to get going, but was relatively painless. I tried to connect to it after a few hours, and couldn't; I found out that I needed to create a new password for the ssh service to work (makes sense, no problem).

Once I did all that, a few hours later I was able to get to the site. Here were the basic steps I took:

- I took my whole web site's "htdocs" directory tree and made a tarball of it:

tar cvf website.tar ./htdocs

This is where my images, PHP code for Drupal + modules, and all my other content sits, at least the content that doesn't get stored directly into the database. (e.g., PostScript documentation that I store on the site for public download)

- I FTPd the tarball over to my hosting provider, just put it somewhere for the time being.

- I took a snapshot of my Drupal database using "mysqldump":

mysqldump -u myusername -pmypassword mydatabasename > databasename.sql

(note: no space between the "-p" and the beginning of the password string. Not sure why that was the case, when there is a space between the "-u" and the beginning of the username string.)

- I FTPd the databasename.sql file to my hosting provider as well.

- I logged into my hosting provider's site, went into the administration interface for it, and asked it to create a new MySQL 5.0 database. I gave the database the same name as I gave when I set up Drupal on my local site. I picked a username and password, then it was ready to go. I noted the hostname where that DB sits, because I need to use that later.

- I used ssh to get into my site. Once there, I unpacked the htdocs tarball:

tar xvf htdocs.tar

- I moved the htdocs directory to be a peer of my existing html directory (the top of the html tree for my existing web site; I'm going to replace that html tree with my new Drupal-based html tree). Now, typing "ls" I see the following

htdocs html

- I went into htdocs/sites/default/files/ and edited the "settings.php" file to make sure the setting for connecting to the database is correct. I needed to update the username, password, and hostname to make sure they all correctly use the production site's values. The line looks something like this:

$db_url = 'mysqli://';

- I moved the original html directory out of the way

mv html html.orig

- I moved the Drupal-based htdocs document tree into place

mv htdocs html

- I was then ready to test by going here:

The Drupal-based content showed up like a charm. Voila!

My first live site push with Drupal worked, no problem.

Next, I'll need to learn how to do site updates: I intend to do more web site development via Drupal on my local machine, using my test/development environment (using VirtualBox to run OpenSolaris as a guest OS, so that my whole environment sits in a single .vdi file that I can put on a USB stick and take and use anywhere I want to go, or copy it onto a DVD or anywhere, really). Anyway, once I make more improvements to my web site, I'll want to push them live, too, so I need to learn how to update an existing live site. I'm hoping that will be pretty easy.

Thursday, March 12, 2009

Drupal Question: Putting Content Into A Block

I'm struggling again today. Yesterday, I managed to put some static content into my Drupal-based web site, and I even have the front page showing this blog. That's great; I was ready to push my test site live, which I don't yet know how to do but was going to read up on it.

But then I got greedy and decided "Hey, wouldn't it be great to show my Twitter 'tweets' on one of the sidebars of the web site? I mean, as long as I'm showing my blog here, why not my micro-blog?" So I did some searching and found a Twitter module that does the opposite: every time I make a change to my Drupal site, Drupal will tweet with my account. I want my account's tweets to show up on my Drupal site!

So, I found different instructions that look better; the section of the page that says to use FeedAPI looked reasonable. I had to install a couple more modules. I did that, configured as the author said (I think), but still no content. I can't see my tweets!

Here's my question: how do I put content into a block? I can see my overall page design has a bunch of blocks. I can create new blocks. But how do I tell a block what kind of content should go into it, or what kind of stuff a block should show? I've put other content into other blocks, but I don't really know how I did it. I'm thinking that's a pretty key concept, connecting content to blocks.

And I don't want to have to write PHP to do it. There must be a simpler way.

I'll keep reading, but right now, it's all pretty confusing to me.

Wednesday, March 11, 2009

Today's Novice Drupal Question

I'm now at the point where I have a really simple web site: maybe 10 pages total, in a hierarchy. All but one page is static content; the one page that isn't static is used for displaying this blog.

Most of the web content is text, with a few links and some images. I need to fix my web pages so that they correctly refer to the images (if I view one of my pages, I just see "broken image" icons showing that the link is no good). That's where my question comes in. I want to know: how does Drupal store my content?

This web page seems to indicate that the content is all stored in the database (MySQL in my case).

Okay, fine. So now I need to transfer my image files onto my web server so that my Drupal pages (nodes) can see them. Does that mean I need to somehow put each image into Drupal so Drupal can assign a node ID to them, keep them in the database? That seems a little goofy; the images are already sitting on my web server in my htdocs directory. Can't I just have my web pages refer to those images?

I'm trying to do this the Drupal way, but I don't know what the Drupal way is for dealing with images.

I'll keep looking for answers.

Oh, and by the way: in the Drupal 6 "Getting Started" documentation, I can't find anything about how to take my test web site and push it to my actual web server. Somebody told me about using "mysqldump", but I don't know if that will cover everything in my web site, or what. And I've never used it before; I need to find documentation on on how to use it to push my site live.

Tuesday, March 10, 2009

Using Drupal to display this blog

I went to DrupalCon last week and had a blast. I decided to try out Drupal by running my web site,, with Drupal. So far, mixed news.
It was incredibly easy to install Drupal. But I've just spent about two hours trying to do what I thought was a simple thing: display my blog on the front page of Turns out it is simple; I just got confused by the Drupal terminology and menu system.

I thought the right thing to do was to create a "Page" node, then somehow find a way to include the contents of the "Feed aggregator" module into the page. Makes sense to me: I've got a module ("Page") for displaying content, and I've installed another module that knows how to grab an RSS feed and extract its contents. I thought that telling Feed Aggregator to put its contents inside my Page node would be the way to do it.

I still don't know how to make that happen, but it turns out there is an easier way to accomplish what I need. I got the info from this tutorial page, entitled "Using Drupal as your RSS Feed Aggregator". That's exactly what I want, and the directions were simple and clear.

The trick: go ahead and activate the Feed aggregator module, which gives it a name that Drupal can refer to as a URL. Then for my site information (Drupal->Administer->Site configuration->Site information menu), tell Drupal that this feed aggregator should be my default front page.

It worked! Now, time to move the rest of the original site into Drupal, then test it out before I publish it.

Monday, March 9, 2009

More Coming in 2009

I've been away from this blog for about a year now, but watch this space: there's more to come. I plan to write a little about media, but also about other technical and non-technical topics.

For example: spreadsheets. I like to use spreadsheets to help me make decisions, mostly purchasing decisions. I created a spreadsheet for house shopping, one for car shopping, and I intend to post both of them to this blog, to share what I learned in case it helps others in their own shopping.

Watch for a spreadsheet I used to track sales prices of homes in Alameda and San Mateo counties in California over the last 3 years. Maybe you'll find it useful.