Blaze Blog

Archive for November 2006

Nov26

Christmas Came Early!

By Andy in News

We very rarely get any snow on Vancouver Island. We’re lucky if we get anything other than rain in the winter, which is a far cry from the rest of Canada.

Snow!

Turns out something went wrong today, we’ve had about 4 inches 1ft and it’s still falling! No doubt there will be utter chaos on the roads as we don’t have the equipment to handle any sort of snowfall.

No wonder the rest of Canada laughs at us while they happily sit in 4 feet of the white stuff. :)

Nov23

Five Wordpress “CMS Enabling” Plugins

By Andy in Development

Wordpress contains almost all the features you need to get it going as a CMS out of the box. However, you’ll find that there are a few things missing that make up the final pieces of the puzzle. Here’s an overview of the five most useful plugins I’ve found, and the part they play in making Wordpress a butt-kicking CMS.

Plugin 1: Filosofo Home-Page Control

The first thing that stumps most people when trying to use Wordpress as a CMS is how to stop blog posts showing up as the home page. If you’re going to use Wordpress to create a typical website, it’s unlikely that you’ll want blog posts as the first thing people see.

This is where Filosofo’sHome-Page Control” plugin comes in handy. This plugin lets you specify any Wordpress page to use as your home page. You can then bump all blogging components into a sub folder such as “my-site.com/blog”. The beauty of this plugin is you can select any of your Wordpress pages to set as your home page, without having to fumble with a “home.php” file in your theme directory. Everything can be handled through the Wordpress admin interface. Perfect.

Plugin 2: Fold Page List

Most simple blogs tend not to have a complex hierarchy of paged content. Full blown websites however, generally do. Most websites rely upon a well thought out navigation system that makes it very clear which section and page the user is currently in.

Wordpress has a built in function called “wp_list_pages” that will generate a nice nested list of all of your pages, which you can then style with some CSS. Hey presto, there’s your navigation. Only trouble is, once you get into pages more than one level deep, you start encountering problems.
Say for instance you use a tabbed navigation system on your website. Even if you are three levels deep, you still want the top level tab to be highlighted. Wordpress’ “wp_list_pages” function will set a CSS class on the list item for the current page you are viewing. Great, that page can be highlighted no problem, but what about all the page’s ancestors right up to the first level tab? No go. They’re left out in the cold with no CSS class in sight. Here’s where the “Fold Page List” plugin comes into play.

By using the fold page plugin’s provided function instead of Wordpress’ “wp_list_pages” you can get around this problem. Even if you are three page levels deep you can be sure that the page’s ancestors will always have a CSS class applied for you to highlight them accordingly. Very handy indeed, and it even uses the same parameters as “wp_list_pages”.

Plugin 3: Search Everything

When you’re using Wordpress for a simple blog, you really only want people to be able to search your blog posts to find the information they want. Your static pages might only consist of a simple about page, or an archives page, and who wants to search those?

Things are a little different when you’re using Wordpress as a CMS. Generally speaking, you’ll probably want pages to be the first thing that Wordpress searches. If you’ve got a site with hundreds of static pages, having a search tool that can scan these pages will become a very handy tool in your site’s belt.

Out of the box, Wordpress will only search your blog posts. No good for a CMS. Thankfully there is the “search everything” plugin from Dan Cameron. Drop in this plugin and you’ll be given a set of admin options that lets you customize what type of content Wordpress will scan for matching results. You have a whole host of options including pages and even posted comments. Combine this plugin with Media Projekt’s search hilite plugin, and you’ll have the search tool you always dreamed of.

Plugin 4: Role Manager

Wordpress comes bundled with five generic user roles, each one allowing greater control of the site through the administration interface. Trouble is, these roles are very “blog-centric” and focus mainly on the ability to create and publish blog posts.

If you’re using Wordpress as a CMS, you’re likely to want the ability to finely tune what a client, or other administrators can and can’t do. For instance, you might want someone to be able to edit and update pages, but not add or delete them. Or, someone could be in charge of keeping external links up to date, so they would only get access to the Wordpress link administration section. The combinations are endless.

Red Alt’s role manager provides this level of functionality in Wordpress. Drop in this plugin and you’ll be creating custom roles in seconds. It comes with a very slick AJAX interface, and let’s you see all permission capabilities at a glance. This plugin takes account management to a new level.

Plugin 5: Site-map Generator

On to number five. No standard website is complete without some sort of site-map. Site-maps allow visitors to get a quick overview of all the pages in your website, as well as giving search engine robots an easy path to indexing all of your content.

The site-map generator plugin from Dagon Design will generate a full site map based on your Wordpress page hierarchy. You’re presented with quite a few options through the admin interface, such as including blog posts in the hierarchy and paginating the site-map in various ways.

The beauty of a generated site-map is you can turn it on and leave it alone, safe in the knowledge that it will reflect any changes to your site’s content. A definite must-have plugin for any size website.

Try this at Home

So, there are the five plugins that I have personally found the most useful. If you are yet to use Wordpress as a CMS, I would whole-heartedly say go for it! I was skeptical at first, as I only saw Wordpress as a blogging tool. Once you start digging deeper, you’ll begin to realize that this is the way Wordpress will be progressing.

I’ve just finished my fourth site using Wordpress as a CMS, and more and more I wish I’d started sooner. Plus, the more you use it, the better you get. My site build time has rapidly decreased just from creating those four sites. Now all that’s left is to convert this site over!

Finally, I’m almost positive that in a year or so, Wordpress will be considered a CMS with a blogging tool, rather than a blogging tool you can use as a CMS. Only time will tell I suppose, but version 2.1 seems to be moving in that direction.

Nov15

Media Temple Problems

By Andy in News

Sorry for the intermittent website outages. It seems as though Media Temple’s new grid server (gs) setup is having some teething problems. Update: Things seem to be running smoothly again.

I signed up for the new (gs) service a couple of weeks ago. The service right now is very unreliable, I’m getting database time-outs every few hours or so. I’m going to stick with it, as Media Temple have a great reputation, I’m sure they will get things sorted out.

This is of course a very new service and they have had a huge number of signups - I’m thinking more than they can handle right now.

If you are coming across issues with the site, my apologies, I’m hoping everything will be cleared up very soon.

Cheers.

Nov9

Changing Domains with a 301 Redirect

By Andy in Development, Projects

When I moved from my old “cssdev.com” domain to “blazenewmedia.com” I didn’t want to lose my search engine rankings, indexed pages, or bust old bookmarks. Here’s how I did it.

301

Firstly, my biggest problem was I used Wordpress for my old blog. This site runs on Textpattern (for now), so all my old post archive links from Wordpress don’t match the same format as the their Textpattern alternatives.

Here’s an example. When someone visits an article from my old site, they might hit up the following address:

http://www.cssdev.com/archives/2006/03/19/css-tweak/

Now, in Textpattern this same article can be found at a much simpler link:

http://www.blazenewmedia.com/articles/css-tweak/

So, how can I make my old Wordpress installation forward people to a new Textpattern formatted link, while still saving my search engine rankings, and ensuring the new page gets re-indexed in the same position?

301 Redirects to the Rescue

By sending a “301: Moved Permanently” header to the browser, it’s possible to tell anyone who visits my old Wordpress installation that the content has moved for good.

Not only that, search engine spiders will follow this redirect and re-index all of my pages in place of the old ones. This preserves search engine rankings and prevents people from seeing a whole bunch of dead links when they find my old site on Google.

To get this to work with Wordpress, all I had to do was place a few lines of PHP code into the “index.php’ file in the root of the site. This file is the hub that all Wordpress pages run through.

Here’s the PHP code I used to send a 301 redirect:

header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.blazenewmedia.com/blog/");
die;

That solved redirecting, but that didn’t solve my problem with incompatible URLs between Wordpress and Textpattern.

To fix this problem, I needed to grab the page that the user had requested, reformat it so that it matched Textpattern’s formatting, then forward them to the new link.

This was done with the following code:

/**
 * Get the requested page: eg /archives/2006/03/19/css-tweak/
 */
$requestedPage = $_SERVER['REQUEST_URI'];

/**
 * Split the requested page
 * into and array of sections
 * using the “/” as a splitter.
 */
$reqArray = explode(”/”, $requestedPage); 

/**
 * Check to see if the second, third
 * and fourth sections (starts at 0)
 * are numbers, if they are we can
 * assume these are dates.
 */
if( is_numeric($reqArray[1]) &&
    is_numeric($reqArray[2]) &&
    is_numeric($reqArray[3]) ) {

 /**
  * Send the correct 301 header.
  */
 header(”HTTP/1.1 301 Moved Permanently”);

 /**
  * Send them to the new textpattern
  * formatted URL. We know that the last
  * section of the URL is the same (/css-tweak/)
  * so we can append that to the end of the URL.
  */
 header(”Location: http://www.blazenewmedia.com/articles/” . $reqArray[4]);
 die; // stop anything else from executing.
}

I’ve had the new site up for just over a week now. Google has already almost completely re-indexed my new site. The links to my old CssDev site are reducing by the day. Soon, all the old CssDev links will be completely converted over to Blaze. It works!

If you’re looking to change your domain, or move your site, 301’s are definitely the way to go. With a little PHP knowledge you can also handle redirecting old bookmarked links, even if the formatting has changed. For me, 301’s have worked flawlessly.

Nov3

Targeting IE 7.0

I’ve only found a couple of ways to specifically target IE 7.0 in my code so far. It’s hard to work out how to fix something in a browser that is so new and I have very little experience developing for.

IE7The two main ones for me are conditional comments and the “first-child+html” fix found by Mark Hammond.

Conditional Comments

Conditional comments are small scripts that you place in your HTML. They check for the version of IE being used, and include whatever you put between the comments if conditions are satisfied. Here’s an example:

<!--[if IE 7]>
 Include my IE7 only stylesheet here.
<![endif]–>

Personally, I tend to stay well away from conditional comments. The idea of putting small scripts within HTML comments makes me shudder. It’s also basically a simple form of browser sniffing, and really, I don’t want to go back to those days thank you very much.

The “first-child+html” workaround

For now, my solution of choice is a little bit of CSS trickery to target IE7 specifically. I’ve used this workaround on this very site. I was having trouble with the logo being too close to the top of the window in IE7. What I wanted was to add an extra 20px of padding to the top of the logo in IE7 only:

#menuBar {
  float: right;
  display: inline;
  width: 240px;
}
   /* For IE7 */
   *:first-child + html #menuBar {
     padding-top: 20px;
   }

This worked a treat, and is perfect for the small fixes I need right now.

Mark Hammond goes on to note that this fix only reliably works when your page starts with a doctype and html element together (which is 99% of the time I would bet).

This of course exploits a bug in IE7, so there is no guarantee it will work in future updates. For now though, it provides the quick fixes I need until I can explore the browser further.

Who knows of any other workarounds for IE7? I’d be interested to hear how you are fixing your sites up to work with Microsoft’s latest.