Print Page | Close Window

Using Incude statments for menu and head

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Web Design Discussion
Forum Description: Discussion on web design and development subjects.
URL: https://forums.webwiz.net/forum_posts.asp?TID=7140
Printed Date: 29 March 2026 at 2:53pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Using Incude statments for menu and head
Posted By: Nathan
Subject: Using Incude statments for menu and head
Date Posted: 10 November 2003 at 12:15pm

I am currently re designing my web site (Who isn't - it's a long grey winter ahead!)

I have decide to copy Bruce's method of including the header, menu (side bar) and footer. Have quickly written the following to test things:

<html>
<head>
</head>

<body>
<table border="0" cellpadding="4" cellspacing="4" style="border-collapse: collapse" width="100%" id="table1">
 <tr>
 <!-- #include file="header.inc" -->
 </tr>
 <tr>
  <td width="160"
  <!-- #include file="side_bar.inc" -->
  </td>
  <td align="left" valign="top">content </td>
 </tr>
 <tr>
  <!-- #include file="footer.inc" --></td>
 </tr>
</table>
</body>
</html>

 

If I use the above as a template for each content page, then I can just add the page text in the middle. Is this how most of you do it?

A small problem I forsee, is that as I divide most of the site into sub folders, how do I reference the inc files if the page is nested a few levels down - ideally, I do not want to have to alter the inlude file statements for each of these pages.

Thanks for any help or guidence you can offer.

Nathan, Corfu Greece




Replies:
Posted By: KCWebMonkey
Date Posted: 10 November 2003 at 1:57pm
dont use virtual include. use absolute paths...


Posted By: Nathan
Date Posted: 10 November 2003 at 11:27pm

Thanks KC,

Tried this: <!-- #include file="http://www.agni-travel.com/corfu-travel-guide/header.i nc" -->

 

But it didn't work

I assume I need to give the path of the server which I think is:

www/corfu-travel-guide/header.inc

Having played with the system more, I realise of course that I also need to change the gif and pictures referenced in the included files - otherwise any pages nested into the site do not show the pics.

Nathan



Posted By: KCWebMonkey
Date Posted: 11 November 2003 at 9:16am

using that path works for me...

http://www.agni-travel.com/corfu-travel-guide/header.inc - http://www.agni-travel.com/corfu-travel-guide/header.inc

maybe you just needed to take out the space between the i and the n at the end of the link.



Posted By: Bluefrog
Date Posted: 11 November 2003 at 9:20am

I use that basic structure. Another thing that I like to do is to use SSI for titles and meta tags. I find that it is nice to be able to control them from one central resource.

I also use a lot of x=request.querystring("x") and select case statements so that I can reuse code on a single page.  Lets me use one page with multiple includes conditionally, and I still get to template things pretty well.

e.g. I switch content in the include itself.

If things aren't working, check your code for typos. You had several above.

And you can't include with "http://". Use the absolute path on the server from the root. Serving content through http requires a lot more.

 

 



-------------
http://renegademinds.com/" rel="nofollow - Renegade Minds - Guitar Software http://renegademinds.com/Default.aspx?tabid=65" rel="nofollow - Slow Down Music


Posted By: Flamewave
Date Posted: 11 November 2003 at 11:01am

Use virtual includes:

<!--#include virtual="/includes/header.inc"-->

if the includes folder was a folder out of the root of your site, then no matter where this include is placed, or how deeply nested into folders it is, it will always look in the same location for the include file. The path is relative to the root of your site.



-------------
- Flamewave

They say the grass is greener on the other side, but if you really think about it, the grass is greener on both sides.


Posted By: Nathan
Date Posted: 15 November 2003 at 12:48am

Thanks everyone - that's exactly what I needed - works perfect now.

Nathan




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net