Adventures in PHP, Drupal, and the Web

Drupal Code Filter Module

I discovered recently that to make my code postings look nice in Drupal, I needed to install the Code Filter module. Now when I enclose my code in <code> </code> tags, it comes out nicely formatted:

<?php
//here are some comments
//with "code" formatting
$some_variable = 123;
echo
"some text";
?>

Google Geographic Target and SEO

I've noticed that some of my websites get a disproportionate number of visitors from Canada, even though they are not targeted at Canadians, and have generic top level domains (.net, .com). I think this may be because Google sees from my server's ip address that it's located in Canada, so Google ranks my sites higher on Google.ca. I'm trying an experiment to see if I can take advantage of this.

What is a CMS?

Drupal is an open source content management system (CMS) for websites.

What does that mean? Basically a CMS is the software that powers a website (such as this one). In the early days of the world wide web, website content existed mainly as static HTML text files on web connected computers. (HTML stands for "HyperText Markup Language", and it consists of tags embedded in a text file that tell a web browser how to display the text, and what files the links lead to). The URL of the page was the computer (domain) name, followed by the directory and file name of the text file (usually ending in .html or .htm to indicate an HTML file). When a user entered a navigated to a URL with a browser, the browser opened the file and displayed the content.

Showing Different Block Content for Each Drupal Node

I want to give Google and other search engines some links to CheapFlightSpy.com to crawl, but I don't want to have the whole list reapeated on every page of this site. Instead, I wrote a small php snippet to put a different link on each node page.

What are PHP and Drupal?

In case you arrived at this site randomly, or by following an out-of-date link, you might be wondering "what the hell are PHP, Drupal, and the Web, and where's the Moxie.ca site about/for Canadian women?"

Viewing Drupal Node Content in a Block

For the CheapFlightSpy.com website, I want to display some text about the departure or destination city in a block (hopefully this will help with SEO). To do this, I created a content type called "citylinks", with a field called "iata" (using the CCK module) for the IATA airport code. The blurb about the city is in the body section of the node. The idea is that when somebody executes a flight search, for example, for flights from Vancouver, I'll find the citylinks content with iata=YVR (the airport code for Vancouver) and display the Vancouver blurb in a block on the flight search results page.

Welcome to Moxie.ca

Welcome to my blog Moxie.ca!

In this blog I'm going to record the various tips and tricks I learn about website development using the Drupal content management platform, and PHP programming. Hopefully it will be a useful resource for other web developers (not to mention myself when I forget how I did something a few months down the road).

Right now I'm working on a travel website called CheapFlightSpy.com, so you'll see lots of references to that.

Syndicate content