I'll start off by teaching you how to create a basic site that uses a menu in
tables. Run Notepad and create a file for your menu, in a table. It might look
something like this: <table border=0 bordercolor="black" cellspacing=0 cellpadding=0 width=780
height=100%>
Make sure that you do not close the table!! Now save this file as
<tr>
<td width=100 valign="top">
<img src="main.jpg"><br><Br>
<a href="index.php">News/Home<a><Br>
<a href="index.php?page=stuff">Stuff<a><Br>
Blah<Br>
Blah<Br>
Blah<Br>
Blah<Br>
Blah<Br>
Blah<Br>
<td>menu.php
and start a new one. It'll have the code for you main page. It should look something
like this: < include("menu.php") ?>
<td width=580 valign=top>
<
if(!$page) {
include("http://www.hobbiton.org/~zeroone/test/news.txt");
}<Br>
else{
include("http://www.hobbiton.org/~zeroone/test/files/" . "$page" . ".php");
}<Br>
?><Br>
<td>
<tr>
<table>
There are two vital things you should notice here. First, we have the <
include("menu.php") ?>
. This tells the computer to include the menu file.
The second thing is this code: <
Make sure you change the URLs to URLs on your server. This code tells
the computer that if the url is something like "www.yourpage.com/index.php"
then it will include the news file, in this case (since I've set it to the URL
of my test site's news file).
if(!$page) {
include("http://www.hobbiton.org/~zeroone/test/news.txt");<Br>
}<Br>
else{
include("http://www.hobbiton.org/~zeroone/test/files/" . "$page" . ".php");
}
?>
IF, however, the URL is something like "www.yourpage.com/index.php?page=stuff
"
then it will change the content of the page to whatever is in the file "stuff.php".
At this point, there is something I should mention. When you have links on a
php page, they will be something like "www.yourpage.com/index.php?whatever=pagename
"
instead of something like "www.yourpage.com/pagename.php
". This
is because the web browser is actually displaying the index file, but it's including
content from another file on the index file. The "whatever=pagename" tells the
computer that the variable "whatever" is set to the name of the page, "pagename"
in this case. That variable tells what page's content should be displayed, using
the code above.
Comments