Problem :(
Moderator: General Moderators
Problem :(
OK Thank you to the person who showed me about how to make pages with the address:
http://www.blahblahblah.com/index.php?id=01 ect...
Now my menu is on everyone of my pages and if i haveto update anything i have to edit it over 20 times which is kinda boring so i know about the INCLUDE tag but for some reason it don't work inside the tags that make your page have the index.php?id=1 at the end.
Please Help!
http://www.blahblahblah.com/index.php?id=01 ect...
Now my menu is on everyone of my pages and if i haveto update anything i have to edit it over 20 times which is kinda boring so i know about the INCLUDE tag but for some reason it don't work inside the tags that make your page have the index.php?id=1 at the end.
Please Help!
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Heres just one of my pages:
and i want the menu section (From <!--Main Menu Start-->
to <!--Main Menu End-->
) as the include thing.
Code: Select all
<?php
switch ($id) {
case 0:
echo "<? include("compteur.php"); ?>
<html>
<head>
<title>Dales UT2K3 Database</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#000000" text="#CCCCCC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bottommargin="0" rightmargin="0" link="#CCCCCC" vlink="#CCCCCC" alink="#CCCCCC">
<table width="1005" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td width="150" height="150"><font size="1" face="Verdana">
<img src="./images/tl.jpg" width="150" height="150"></font></td>
<td width="855" colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" background="./images/tbg.jpg">
<tr>
<td><font size="1" face="Verdana">
<img src="./images/tl3.jpg" width="100" height="150"></font></td>
<td width="100%"> </td>
<td><font size="1" face="Verdana">
<img src="./images/tr.jpg" width="500" height="150"></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td rowspan="2" width="150">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" background="./images/lbg.jpg">
<tr>
<td><font size="1" face="Verdana">
<img src="./images/tl2.jpg" width="150" height="188"></font></td>
</tr>
<tr>
<!--Main Menu Start-->
<td height="100%" valign="top"><font face="Verdana" size="1"><b> Main Menu</b><br>
<a href="http://www.imahosting.com/dale/test/index.php">Home</a><br>
<a href="http://www.imahosting.com/dale/test/forums/">Forum</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=1">Staff</a><br>
<a href="mailto:dale@host.sk">Contact Me</a><br><br>
<b>UT2K3 Stuff<br></b>
<a href="http://www.imahosting.com/dale/test/index.php?id=2">Info</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=3">Cheats</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=4">Demos</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=5">Gallery</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=6">Maps</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=7">Mods</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=8">Mutators</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=9">Patches</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=10">Skins</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=11">Sounds</a><br>
<a href="http://www.imahosting.com/dale/test/index.php?id=12">Videos</a><br>
Submit<br><br>
<b>Counter<br></b>
<? echo $hits; ?>
</font></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</td>
<!--Main Menu End-->
<td valign="top" width="5">
<p align="center"><font size="1" face="Verdana"><br></font></p>
</td>
<td valign="top" width="776">
<p align="center"><br>
<a href="http://www.gamer.uk.com/cgi-bin/aff_jump.cgi?uid=utdale">
<font size="1" face="Verdana">
<img src="http://www.gamer.uk.com/banners/pc/u2_468_pc.gif" border="0" width="468" height="60"></font></a></p>
<p align="center"><font size="1" face="Verdana">News </font>
<p align="left">
<--News-->
<p> </td>
<td valign="top" width="5">
</td>
</tr>
<tr>
<td valign="bottom" width="855" colspan="3">
<p align="center"><font face="Verdana" size="1">Site Designed By <a href="http://www.imahosting.com/cicid/">
Ciced</a></font></td>
</tr>
</table>
</body>
</html>";
break;to <!--Main Menu End-->
) as the include thing.
-
Litazia Tanxashira
- Forum Newbie
- Posts: 3
- Joined: Tue Jun 25, 2002 5:46 pm
Um O.o
May I make a couple of suggestions?
"<?php" and "?>" are your friends. So, instead of echoing all of that *shudder*, do this:
Better yet, why not stick all the HTML into one file, and call it something like page0.php (or whatever)? Then you'd get this:
That way, you can write it in as pure HTML, and you don't have to escape every single special character you come across. And, for that matter, it makes it easier to read. So, when you come back to it in a year, say, you're not clawing your eyes out!
(It makes it even better if other people have to debug your code. You want to make their lives happy, because you sure as heck wouldn't want other people to make your life miserable!)
Now, as for your menu: Stick all of that (as pure HTML) into a file (let's call it mainmenu.php). Now, we go back to page0.php (as I called it earlier). What you do is this:
(Note that having the "<?php" and "?>" tags on separate lines like that is personal preference. AFAIK, it's entirely acceptable to have all of that on one line.)
So, now that the menu's in one file, you can edit just the one file, and everything will be happy
"<?php" and "?>" are your friends. So, instead of echoing all of that *shudder*, do this:
Code: Select all
switch ($id) {
case 0:
include("compteur.php");
?>
<!-- your HTML goes here -->
<?php
break;
etc...
}Code: Select all
switch ($id) {
case 0:
include("compteur.php");
include("page0.php");
break;
etc...
}Now, as for your menu: Stick all of that (as pure HTML) into a file (let's call it mainmenu.php). Now, we go back to page0.php (as I called it earlier). What you do is this:
Code: Select all
<!--Main Menu Start-->
<?php
include("mainmenu.php");
?>
<!--Main Menu End-->So, now that the menu's in one file, you can edit just the one file, and everything will be happy
-
Litazia Tanxashira
- Forum Newbie
- Posts: 3
- Joined: Tue Jun 25, 2002 5:46 pm
Code: Select all
<?php
include("mainmenu.php");
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Code: Select all
<?php
switch ($id) {
case 0:
echo "<? include("compteur.php"); ?>
<html>
<head>
<title>Dales UT2K3 Database</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#000000" text="#CCCCCC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bottommargin="0" rightmargin="0" link="#CCCCCC" vlink="#CCCCCC" alink="#CCCCCC">
<table width="1005" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td width="150" height="150"><font size="1" face="Verdana">
<img src="./images/tl.jpg" width="150" height="150"></font></td>
<td width="855" colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" background="./images/tbg.jpg">
<tr>
<td><font size="1" face="Verdana">
<img src="./images/tl3.jpg" width="100" height="150"></font></td>
<td width="100%"> </td>
<td><font size="1" face="Verdana">
<img src="./images/tr.jpg" width="500" height="150"></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td rowspan="2" width="150">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" background="./images/lbg.jpg">
<tr>
<td><font size="1" face="Verdana">
<img src="./images/tl2.jpg" width="150" height="188"></font></td>
</tr>
<tr>
<!--Main Menu Start-->
<?php
include("mainmenu.php");
?>
<!--Main Menu End-->
<td valign="top" width="5">
<p align="center"><font size="1" face="Verdana"><br></font></p>
</td>
<td valign="top" width="776">
<p align="center"><br>
<a href="http://www.gamer.uk.com/cgi-bin/aff_jump.cgi?uid=utdale">
<font size="1" face="Verdana">
<img src="http://www.gamer.uk.com/banners/pc/u2_468_pc.gif" border="0" width="468" height="60"></font></a></p>
<p align="center"><font size="1" face="Verdana">News </font>
<p align="left">
<--News-->
<p> </td>
<td valign="top" width="5">
</td>
</tr>
<tr>
<td valign="bottom" width="855" colspan="3">
<p align="center"><font face="Verdana" size="1">Site Designed By <a href="http://www.imahosting.com/cicid/">
Ciced</a></font></td>
</tr>
</table>
</body>
</html>";
break;