Muffinresearch Labs by Stuart Colville

Better simple site structure | Comments (0)

Posted in Muffin Research Labs on 18th June 2004, 5:08 pm by Stuart

I decided to look at this site’s directory structure as I knew that the way I had put it together was not the most logical. I had created the layout for the site the way I had always done, however, having checked out sites like zeldman.com et al, that there was a better way.

What I did was rearranged the structure so that each navigational item was now in it’s own directory. Like this:

Diagram of Directory Structure

This also meant that CSS stylesheets and any source files were now referenced using relative values to the site root. Now CSS is accessible from any new directory on the site which is a lot better that having “../../main_styles.css” all over the place. Ok so that’s an exaggeration but it’s so much better having one way of defining a stylesheet’s location.

This method will really help when I come to write the archiving sections for the blog script. : )

The site was now in a much better shape. I also got rid of the daft and unecessary css and php includes that gave each page it’s different graphic in the header2 div. I replaced them with simple inline styles that overwrite the original value in the main stylesheet!

The only issues I had were when I tried to use relative links to the php includes starting with a “/”. I then found out that PHP includes are run relative to the script that uses them. What I did to resolve this was to remove all references to directories from the includes. That means you are left with for example:

include 'header.php';include 'nav.php';

Instead of:

include '/adirectory/header.php';include '/adirectory/nav.php';

I then used a “.htaccess” file to specify the location of my included files so that php knows where to look for them. This file goes in the site root.

php_value include_path "/home/virtual/var/www/directory/"

This resulted in a much easier way to take care of future php include files.

Post Tools

Comments: Add yours







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Using Loggerhead with mod_wsgi|(0)

Here’s a post I wrote over on the Project Fondue Blog about our use of Loggerhead with mod_wsgi under Apache. Loggerhead is the rather nice branch viewer for bazaar branches as used on Launchpad.net.

If you’re not already subscribed to the Project Fondue blog feed then I can recommend it, as there should be some interesting posts coming out of there in the coming months (yes I’m unashamedly biased!).

Ubuntu: Turn off changing workspace with mouse wheel|(1)

I found the changing with the workspace with the mouse wheel really annoying. To disable it go to System => Preferences => CompizConfig (available if the compizconfig-settings-manager package is installed) and uncheck “Viewport Switcher” which is under the “Desktop” heading.

Photos on Flickr

© Copyright 2004-10 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.764s.