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>



Standalone mac battery charger|(0)

Got a spare mac battery? I’ve often wondered why up until now no-one’s produced a standalone charger so that you can charge batteries without having to plug them into the mac. Fortunately Fastmac.com have produced a standalone charger that allows you to do just that. and it’s compatible with iBooks, Powerbooks, macbooks and Macbook Pros. It’s also 110/200v. Exactly what I was looking for!

Django Admin Ominigraffle Stencil|(0)

Colleague Alex Lee has created a nice stencil for omingraffle with the Django Admin UI components, perfect for wireframing customised admin screens. For more details and to download the stencil see Alex’s Blog csensedesign.co.uk

Photos on Flickr

© Copyright 2004-08 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by 1&1 This page was baked in 0.715s.