Directory Structure

This page's vital information:

  • Physical location: ./pages/00_Home/Directory Structure.html
  • Link here with: <a href="?page=Directory Structure">


As stated before, the directory structure of your content is important.

The default installation contains the following directories in the top level of the install:

./hidden_pages The directory where active page content can be placed, but that won't be picked up by software when producing the category / page list (for example, <Image.php>).
./images The directory where all images / photos etc should live (especially if you wish to use <Image.php> to display them).
./includes All of the functions etc. that the software needs to operate (all called from <index.php>).
./pages The directory where all active content should be placed that you wish to be displayed in the category / page list.
./stats The directory of page view counters.
./style_sheets The directory of Cascading Style Sheets.
./text_files The directory of any text files to be displayed with Text Viewer.

The most important directory is ./pages.

There are 4 levels of "page" available to you:

  • A category
  • A page
  • A sub-page
  • A link to another website *

I will use these expressions throughout this web demo.

* Note that a link file will not display content within this software. It is meant for linking to another related website, perhaps on the same server as this software and will replace the browser contents in the same window.

Category

These give the headings on the page list.

A category is a directory which lives inside the ./pages directory.

The directories are sorted alphabetically before being displayed. However if you do not wish to have them sorted in such a way, then a numerical sorting is allowable.

You do this by preceding the directory name with a number and an underscore. The category directories for this web site are as follows:

  • 00_Home
  • 10_News
  • 20_Another Category
  • Animals
  • Random

The number prefix does not get displayed on the screen - it is purely there to allow a non-alphabetical sorting order.

A category may be purely a heading (for example, "Another Category" and "Random"). If you wish this, then you need do nothing.

If however, you wish to make the category a link to a page, then you must have a page name in the ./pages directory of the same name but without the prefix. Valid page names end with <.php>, <.html>, <.htm> or <.link> - nothing else.

The categories "Home", "Animals" and "News" are all links. (Note that the page for "Home" and the directory for "News" are special cases.)

These categories become links as the ./pages directory contains:

  • Home.html
  • Animals.html
  • News.php

There is a search order for finding pages and it is:

  1. <.php>
  2. <.html>
  3. <.htm>
  4. <.txt>

As soon as a page with the same name as the category and one of these extensions is found, the searching stops for that category, i.e. if "News.php" exists, the "News.html" and "News.htm" will be ignored.

The reason that there is no number on the content page (to make the category a link) is to cut down on the amount of re-naming if you wish to change the order of the categories: you only re-name the directory. Also when you read about how to link to a page you will see the added advantage that you don't need to re-reference any and all links in the rest of your page content.

If the Category directory is empty, then "Nothing Found" will be displayed under the category heading.

Special case: News

Since the News is a "blog" style news feed that will be sorted by date in reverse order, i.e. such that the latest News item appears first, then another strict structure must be followed.

(It should be noted that there is different code for scanning normal categories and the News category to facilitate this special case.)

Within the News category directory (10_News in this example), the software will only scan for directories. The directories must be of the format YYYY-MM (Year-Month, e.g. 2009-01 for January 2009).

Within these directories, the News "items" must be in the following format:

YYYY-MM-DD_News Item Title.html

for example 2008-12-02_Something Interesting.html

The software will scan for nothing else - no more directories within directories, no files in the "News" directory - only in YYYY-MM directories.

Pages

A page is a content file (with any of the above extensions) that exists within a category directory.

These pages will be displayed as links under the category heading.

The pages are also sorted alphabetically, unless a numerical prefix (as described above) is added to the file name, in which case they will be sorted numerically.

For example, the 2 pages under the Animals category are "Orangutan" and "Swan", but note how they are not ordered alphabetically. The file names are "2_Orangutan.html" and "1_Swan.html" respectively.

Special case: Home

The only page name that absolutely must exist is the "Home" page as this is the default page when no page is requested.

Sub-pages

A sub-page is a content file (with any of the above extensions) that exists within a directory of the same name as the page content file (minus the extension).

The sub-pages are only visible if and when the page or any other sub-pages under that page are being displayed.

For example, if you were to view the Content Pages, you would see a sub-page appear called Package Pages (which describes the pages you get bundled in with this package, for example Site Map).

These sub-pages follow exactly the same sorting method as previously described, using a number prefix if required.

Link Files

A link file is a file (with a <.link> extension) that exists in place of any other content file (be that of a category / page or sub-page) which contains only the text for a hyperlink for linking to another website.

For example, the link "A Website Link" under the "Random" category contins the following:

http://www.gavsworld.net/



Del.ico.us Digg Facebook Google LinkedIn LiveJournal NewsVine reddit StumbleUpon Twitter
Valid XHTML 1.0 Transitional Valid CSS! [Valid Atom 1.0] [Valid RSS 2.0]
[ Page last updated 21:42 Thu 25th Mar 2010 | viewed 2046 times ]