PDA

View Full Version : Webpage footer


reaction
10-05-2002, 03:02 PM
Hi,

I would like a footer or header to load on every page, but the code to come from the same single file.

Is it possible to load a webpage into a table cell?

Thanks for any help

AllanSun
10-05-2002, 05:33 PM
It's quite easy when you are using PHP
Just simply put the code below into the table cell where you want it to be.


<?php
include('header.inc');
?>


there you can use HTML or PHP in the header.inc file.

MJB
10-05-2002, 07:01 PM
If you're using .shtml files you can do this with a CGI script and call it to each page via SSI

<!--#include virtual="/cgi-bin/footer/footer.cgi"--> for example.

The script is very small and all you do is create a footer / header text file with your code in it.

The attached file contains both the files that you require. ;)

Upload the folders to your cgi-bin directory and CHMOD footer.cgi and header.cgi to 755. The .txt files don't need to be changed as they are only read.

reaction
10-05-2002, 10:52 PM
MJB - Thanks very much. I'm not using SHTML though, and would prefer to do it with the simpler(?) PHP.

Allan - Thanks, it don't work though. I think I need to include PHP or something. I've renamed .HTM to .PHP but it makes no difference.

R

Decker
10-05-2002, 11:02 PM
Other option is using frames - yuck

AllanSun
10-06-2002, 02:37 AM
Originally posted by reaction
MJB - Thanks very much. I'm not using SHTML though, and would prefer to do it with the simpler(?) PHP.

Allan - Thanks, it don't work though. I think I need to include PHP or something. I've renamed .HTM to .PHP but it makes no difference.

R
!!!
for those codes
you need to have the header.inc in the same directory. Make sure you did that.

efc
10-06-2002, 11:28 AM
Just like to add that naming php includes as .inc is not recommended.

You should name them something like .inc.php.

You could also create a php directory and store all your php scripts in there.

BTW, you can use the php ini_set command to change the default PHP include path. This will take care of any script location issues when you 'include' them into your scripts.

DaveD
10-13-2002, 09:21 PM
I use the

<?
include("header.php");
?>


and

<?
include("footer.php");
?>


in my web pages which are all named .php. The header.php and footer.php are in the htdocs directory with the other pages. Make sure you use the "exact" name and they "ARE" case sensitive.

If you want to change anything in the header or footer you just edit the relevant file and it will alter in every page.

Carthago
12-27-2002, 07:01 PM
This 'include' is some crime to me too.

I made a folder in the docs one wich i named 'includes'.

the pages are in different folders throughout the site and on every page there are three elements which i use always (header, footer, mainlinks)

Reading a lot about this i just have my pages named .php (this i did by using an editor - DW) by saving as and choosing the php option.

The pieces code (html) which i want to include i made in a text editor (notepad) and saved it as .php.txt (after uploading i renamed them in .php

So the page is not loading right at all and also the pages in deeper folders are not loading with the header, etc..

What is a good way (and no frames because i hate them) to include in this case?