Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
Related Forum Posts
Featured Web Site Template

Hundreds More at Free Site Templates.com!

Web Site Partners
Sponsored Links
Jet City Software
 
Whos Here ?
Reflects user activity within the last 5 minutes
Moderator(s): Prowler, jcokos
Member Message

shoe36
Joined: Nov 19, 2001
# Posts: 90

View the profile for shoe36 Send shoe36 a private message

Posted: 03/05/2006 07:07 am
Edit Message Delete Message Reply to this message

I have heard that you can create an external file for your site navigation that would allow you to make a change to one file and that change would popolate throughout all of the pages referencing that file. I have heard this called an "include" file or somthing similar.

Would anyone know how to go about creating this or maybe where some tools would be to do this easily? I suppose the reason for it being an external file would be for the search engines, is that correct?

thanks in advance for your help!





g1smd
Moderator
Joined: Jul 28, 2002
# Posts: 10183

View the profile for g1smd Send g1smd a private message

Posted: 03/05/2006 10:21 am
Edit Message Delete Message Reply to this message

You need PHP, or some other server-side scripting language, for this.

Make a HTML file with the code snippet for your navigation:

<div class="nav">
<a href="/section.1/">Section 1</a>
<a href="/section.2/">Section 2</a>
<a href="/section.3/">Section 3</a>
<a href="/section.4/">Section 4</a>
</div>


Save that file as /includes/navbar.inc on the webserver.



In your HTML page where you want the navbar to appear, just put

<?php include('/includes/navbar.inc'); ?>

and the server will insert it there before it sends the page out to the web browser or bot that has requested it.



Dinkar
Moderator
Joined: Aug 12, 2001
# Posts: 4317

View the profile for Dinkar Send Dinkar a private message

Posted: 03/05/2006 11:33 am
Edit Message Delete Message Reply to this message

Put your HTML code in a separate html file (menu.htm) and use the following code in all other HTML files :



Code: [copy]





Then rename all your .htm and .html files as .shtml except menu.htm

Or you can configure your server to parse .htm/.html files as .shtml

You need to add the following code in your .htaccess file:

AddHandler server-parsed .html









Prowler
Moderator
Joined: Aug 14, 2000
# Posts: 1720

View the profile for Prowler Send Prowler a private message

Posted: 03/06/2006 10:57 pm
Edit Message Delete Message Reply to this message

>>I suppose the reason for it being an external file would be for the search engines, is that correct?

No. Keeping your navigational links and footer information in a separate external file is for your ease of maintaining the site. Suppose you have 100 pages in your site and you need to modify/add/delete some links in the navigation section in all those pages - this would mean working on all 100 pages.

If you have an external file, you just modify this file alone and your change is reflected in all the 100 pages.
Search engines don't know anything about your file inclusion and they don't care how you do it.

As my colleagues pointed out there are many ways of including external files. If you go by the PHP route as pointed out by g1smd, your files need to be set for parsing by the server.
Again this is easily set by a .htaccess directive if you are in a *nix/Apache server (provided your server admin has enabled this for your virtual server).

The second instance is what is called as SSI ( server side includes) as pointed out by Dinkar.



shoe36
Joined: Nov 19, 2001
# Posts: 90

View the profile for shoe36 Send shoe36 a private message

Posted: 03/07/2006 05:22 am
Edit Message Delete Message Reply to this message

I appreciate all of the help. I understand about the reason for external nav files and being able to make one change that effects all of the pages. I guess that I have also heard that you could do this with Java script and that you should have that code externally so as not to bog down the pages with this code and dilute the site for reasons of search engines.

thanks again for all of your advice. I just hope I can figure out how to do this easily as I have limited programming experience.



g1smd
Moderator
Joined: Jul 28, 2002
# Posts: 10183

View the profile for g1smd Send g1smd a private message

Posted: 03/07/2006 06:01 pm
Edit Message Delete Message Reply to this message

Do not use Javascript for this. Search engines cannot follow the Javascript code, so they will not be able to index your site.

You must do this as a server-side function: PHP, SSI, CF, or ASP, etc. The bots will not be able to see the joins in those cases.


You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
  1. You have not yet logged in, or registered properly as a member
  2. You are a member, but no longer have posting rights.
  3. This is a private forum, for which you do not have permissions.

If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

If you cannot find this message, click here to Re-Send it.

If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

New posts Forum is locked
© 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions