Friday 16 September 2011

When people make a site, do they type their navigation links for every page?

when people make a site, and for example the homepage is index.htm rite, and you type all your links their that you want to show up on every page of the site, like the link %26quot;home%26quot; so people can easy so home whereever they are on the site, do you have to type the home link on every single page of your site?? or is their a way like in css stylesheets, to have the links in one place and the other pages can connect to it?? this is urgent for like when you have to change a link, and you a lot of pages, and you have to go through every single page to change the link....iits hard..it is.When people make a site, do they type their navigation links for every page?It's a matter of personal choice, but usually if there are a lot of links to be changed, an include file is used. There are a couple of ways to do this: you can use Server-Side Includes or a scripting language like PHP. Create a file with the just navigation bar or whatever in it, and you can include it from other pages. That way, to change a link, you just modify the include file.



Server-side includes (This is if your web server uses Apache):

%26lt;!--#include virtual=%26quot;include-file.html%26quot; --%26gt;



PHP:

%26lt;?php include(%26quot;include-file.php%26quot;); ?%26gt;
When people make a site, do they type their navigation links for every page?
Think about it. If you create a %26lt;div%26gt; for a navigation bar you can include a page for just the navigation bar in the %26lt;div%26gt; then you can simply modify the include page and it will update every page it is included from.
When people make a site, do they type their navigation links for every page?
Most webmasters will use an %26quot;include%26quot;.



This allows them to set up one file that has all the information that they want.



Then on the other pages they make a call to include that one file.



That way, when they update that one file, it instantly updates on all the pages that it is included on.



In php, this is done like this:

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



Depending on your coding environment, you may need to use a different method.



I've posted a source about includes below.