Linking To Pages

This page's vital information:

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


After you have created some page content you'll more than likely want to link to it from some other web page. Obviously if you have the page in the ./pages directory it will be automatically picked up and displayed in the category / page list (assuming you have strictly followed the directory structure specified.

All pages are accessed through <index.php> with a parameter called "page" as follows:

<a href="?page=Site Map">Site Map</a>
or
<a href="index.php?page=Site Map">Site Map</a>

I tend to favour the first option as most web servers will provide the <index.php> for free and indeed that's how the software will present all links.

Important

As will become clear, you cannot have categories of the same name (but different number prefixes) or pages with the same name in different categories or even pages with the same name as categories. Sub-pages within different pages may have the same names though.

How Does The Software Find Pages?

The software has an order of precedence for searching directories for a page that has been requested:

  1. ./pages (to find Categories)
  2. Category directories in ./pages listed in displayed order (to find Pages / Sub-pages)
  3. ./hidden_pages (to find Pages / Sub-pages)
  4. Category directories in ./hidden_pages (if they exist) listed in displayed order (to find Pages / Sub-pages)

Within each directory, there is an order of precedence for searching for a page that has been requested:

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

So as you can see, the first match will be included into the page, hence the statement above about identical file names. Note that link files <.link> are not included as they don't actually have a page.

Linking to Categories

Any category (that has a page attached) may be linked to simply by requesting the category name. The number prefix is not required and in fact it is better without it as, simply re-numbering the category to change the category list order will not affect any links.

For example:

<a href="?page=Home">Home</a> ( produces Home )
or
<a href="?page=Animals">Animals</a> ( produces Animals )

Linking to Pages

Any page may be linked to by specifying the page's filename (without the file extension). This facility allows a page to be changed from a *.html file to a *.php file without having to fix broken links.

Any sorting number prefix in the page's file name is optional when calling a page (as of v2.15.0).

An important point to note here is that the category that the page lives in is not specified. This is to allow for a page moving from one category to another without having to fix broken links.

For example:

<a href="?page=Erannoo">Erannoo</a> ( produces Erannoo )
or
<a href="?page=1_Swan">A swan</a> ( produces A swan )

Linking to Sub-pages

Any sub-page can be linked to in a similar manner to linking to a page. Again, the category can be ignored, but you must specify the full path to the sub-page (numerical sorting prefixes optional).

Remember that no sub-pages are visible unless they are being viewed or their parent page is being viewed, or another sub-page of that parent page is being viewed.

For example:

<a href="?page=Content Pages/Package Pages">Stuff</a>
( produces Stuff )

or
<a href="?page=1_Swan/Swan In Hiding">Hidden swan</a>
( produces Hidden swan )

A Handy Tip

If you can't figure out the linking to pages, then simply create the page that you wish to link to, refresh the page and hover over its entry in the category / page list and you will see the link there (normally at the bottom of your browser window).

Linking to Hidden Pages / Sub-pages

These are linked to in exactly the same manner as described above. The only difference is that you'll have to remember where these pages are as they will never appear in the category / page list or the Site Map, meaning that you can't use the handy tip!

For example:

<a href="?page=Purple/A Hidden Page">Hidden Page</a>
( produces Hidden Page )

Note that if you had a hidden page in exactly the same [page] directory name in ./hidden_pages as it appears in ./pages, then the sub-pages that are in ./pages will still be displayed as described above.

For example:

<a href="?page=1_Swan/Really Hidden Swan">Really Hidden Swan</a>
( produces Really Hidden Swan )

Linking to non-existent Pages / Sub-pages

If you link to a page that doesn't exist (try "About" in the top menu) you will be presented with an error screen.




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 22:31 Mon 14th Sep 2015 | viewed 1429 times ]