Include HTML on every page

A

Anonymous

Guest
I have a site with about 200 pages. Right now I'm using frames with a Table Of Contents on the left side of the page.

I want to go away from this and just create a single page for every item I sell - but each page must still include the Table Of Contents.

How can I use PHP to include the Table Of Contents within each page in my site?

I've tried INCLUDE and REQUIRE but I suppose I don't understand something. I'm totally new to PHP. But I am a pretty good Visual Basic programmer.

I'd like to make each page a 3x2 table. The Table Of Contents goes in Row 2, Column 1. Can anyone give me an example of how to do this?
 
Could you be more obvious..i understand you want to put a menu in row 2 colmn 1 but why do you need php to do this? like..does the menu have to be dynamic? or is it static? a simple include in php is <?php include("page.php");?>

dunno what u want >< :-o
 
I could do it easily enough with HTML. But I want to make it easier to update the site. If I do HTML on every single page, then I'll have to edit every single page and upload every single page any time I want to make a simple edit to the Table Of Contents. If I make it an Include, then I'd only have to edit one page - the Table Of Contents itself.

Can I Include an HTML file or does it have to be a PHP file?
 
Ok DroopyPawn, here goes a simple example:
Code:
This is your header.php file: 
<html> 
<head><title>Testing include</title></heade> 
<body>

This is your footer.php file: 
</body> 
</html>
They can even be .txt!

So, in your contents.php you´ll make :
Code:
<?php include "header.php"; ?>
<table> 
<tr> 
<td> 
email me: <a href="mailto:you@yoursite.com">you@yoursite.com</a> 
</td> 
</tr> 
</table>
<?php include "footer.php"; ?>

Result (code view): calling your contents.php
Code:
<html> 
<head> 
<title>Testing include</title></heade> 
<body> 
<table> 
<tr> 
<td> 
email me: <a href="mailto:you@yoursite.com">you@yoursite.com</a> 
</td> 
</tr> 
</table> 
</body> 
</html>

Cheers,
Gesf
 
Based on your example, I got it to work. That opens up a world of new possibilities. But now I have new questions.

Cannot an HTML file with a PHP scrip use the Include statement? If so, does it have to include a PHP file, or can't it include another HTML file?

On my business site, I have a search engine that will look through the Keywords tag in each page to find the customer's search topic. Do you think the same thing can be done with PHP files instead of HTML?

Sorry if this seams too simple. I really have never messed with PHP before.

Thanks for the help.

Now I guess I need to start thinking about a new shopping cart.
 
DroopyPawn said:
Cannot an HTML file with a PHP scrip use the Include statement? If so, does it have to include a PHP file, or can't it include another HTML file?

The only difference between a PHP script and an HTML file is that one is processed by PHP on the server side and one isn't. They're both just text. If your file contains a PHP include as is processed by PHP on the server side, then your include will obviously be processed.

And you can include any file in a PHP script. If there's no PHP in the file, it will be included as straight text.

On my business site, I have a search engine that will look through the Keywords tag in each page to find the customer's search topic. Do you think the same thing can be done with PHP files instead of HTML?

Yes, but there are probably a dozen different ways to do it, and I can't recommend just one.
 
Back
Top