Tuesday, September 13, 2011

Links within a large website - not having to change every page when links are changed?

I am trying to remember how to do this.

I have a basic HTML website with many pages. I want to put in a code that allows me to have my linkbox on everypage in the same area but do not want to have to change every page everytime I change a link within my linkbox.Links within a large website - not having to change every page when links are changed?
As stated, Server Side Includes (SSI), but you don't have to use PHP to use it.



http://en.wikipedia.org/wiki/Server_Side



http://www.htmlbasix.com/includes.shtml#



RonLinks within a large website - not having to change every page when links are changed?
One very simple way to do this is with php.



You just need to create a file with a .php or htm extension and put your navigation 'linkbox' mark-up in there and then link to that on each page like this:



%26lt;?php

include ';linkbox.htm';;

?%26gt;



The only drawback is that it requires that you are running on a system that runs php. I mean on the server that runs your website...most do have php these days anyway.



You will have to name your pages .php rather than .html or .htm if you do use these includes, but you don't have to change anything else.



Sorry to sell php so blatantly, but once you have it you can also handle forms/email sending, update your copyright automatically, show pictures or greetings randomly, and on and on.
People usually call this technique extension. They create the menu or layout in ONE file, and use links to place them all in one page.

i.e

(for HTML based Page):

-- Create the menu with JavaScript --

%26lt;html%26gt;

%26lt;head%26gt;

%26lt;/head%26gt;

%26lt;body%26gt;

%26lt;script src = 'menu.js' %26gt; %26lt;/script%26gt;

...html content...

%26lt;/body%26gt;

%26lt;/html%26gt;

-- When you want to edit one link, go into menu.js and it will change for all pages.

(for PHP based pages):

%26lt;html%26gt;

%26lt;head%26gt;

%26lt;/head%26gt;

%26lt;body%26gt;

%26lt;? include(';menu.php';); ?%26gt;

.. HTML Content ..

%26lt;/body%26gt;

%26lt;/html%26gt;

-- Menu.php will include the HTML for the menu. --

Good Luck!

If you need further assistance/advice understanding what i am saying, feel free to contact me.

No comments:

Post a Comment