Forum Moderators: coopster
<?php
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-type" content=
"text/html; charset=us-ascii">
<title>Here is my one and only title</title>
<meta name="keywords" content=
"a bunch of stuff that describes the site but I've been reading that this is pointless">
<meta name="description" content=
"some more stuff">
<meta name="author" content="Me :-)">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" >
<link rel="icon" href="/favicon.ico" type="image/x-icon" >
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" >
<script type="text/javascript">
//<![CDATA[
sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++){
sfEls[i].onmouseover=function(){
this.className+=" sfhover";}
sfEls[i].onmouseout=function(){
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");}}}
if (window.attachEvent) window.attachEvent("onload", sfHover);
//]]>
</script>
</head>
<body>
<div id="Wrapper">
<div id="Header">
<div id="banner">
<a href="index.php" title="Main Page" rel=
"contents"><img src="img/Title.jpg" ></a>
</div>
<?php
//Banner changer based on place
if(isset($_GET['Page'])){
$Location = $_GET['Page'];
switch($Location){
case "1.php":
echo "<div class=\"Banner1\"></div>";
break;
case "2.php":
echo "<div class=\"Banner2\"></div>";
break;
case "3.php":
echo "<div class=\"Banner3\"></div>";
break;
case "4.php":
echo "<div class=\"Banner4\"></div>";
break;
case "5.php":
echo "<div class=\"Banner5\"></div>";
break;
case "6.php":
echo "<div class=\"Banner6\"></div>";
break;
default:
echo "<div class=\"Banner\"></div>";
break;
}
}
else
echo "<div class=\"Banner\"></div>";
?>
<div id="ContentWrapper">
<?php
if(isset($_GET['Page']))
{
$page = "pages/";
$page .= $_GET['Page'];
if(is_file($page))
{
include($page);
}
else
{
include('pages/404.php');
}
}
else
{
include('pages/default.php');
}
?>
</div>
</div>
</body>
</html>
Like:
if(isset($_GET['Page'])){
$startPage = $_GET['Page'];
switch($startPage){
case "1.php": ?>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=us-ascii">
<title>Title for Page 1</title>
<?php
break;
And so on.
Do the following
1) Put that HTML into a PHP variable
2) change your title to <title>#TITLE#</title>
3) in the switch statement, replace #TITLE# in variable according to the Location
4) echo that variable's content.
Cool? here is it working
-----------------------------------------------------
<?php
session_start();
$html='
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-type" content=
"text/html; charset=us-ascii">
<title>#TITLE#</title>
<meta name="keywords" content=
"a bunch of stuff that describes the site but I\'ve been reading that this is pointless">
<meta name="description" content=
"some more stuff">
<meta name="author" content="Me :-)">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" >
<link rel="icon" href="/favicon.ico" type="image/x-icon" >
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" >
<script type="text/javascript">
//<![CDATA[
sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++){
sfEls[i].onmouseover=function(){
this.className+=" sfhover";}
sfEls[i].onmouseout=function(){
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");}}}
if (window.attachEvent) window.attachEvent("onload", sfHover);
//]]>
</script>
</head>
<body>
<div id="Wrapper">
<div id="Header">
<div id="banner">
<a href="index.php" title="Main Page" rel=
"contents"><img src="img/Title.jpg" ></a>
</div>
';
//Banner changer based on place
if(isset($_GET['Page'])){
$Location = $_GET['Page'];
switch($Location){
case "1.php":
$html.= "<div class=\"Banner1\"></div>";
$html=str_replace("#TITLE#","Title for Page 1",$html);
break;
case "2.php":
$html.= "<div class=\"Banner2\"></div>";
$html=str_replace("#TITLE#","Title for Page 2",$html);
break;
case "3.php":
$html.= "<div class=\"Banner3\"></div>";
$html=str_replace("#TITLE#","Title for Page 3",$html);
break;
case "4.php":
$html.= "<div class=\"Banner4\"></div>";
$html=str_replace("#TITLE#","Title for Page 4",$html);
break;
case "5.php":
$html.= "<div class=\"Banner5\"></div>";
$html=str_replace("#TITLE#","Title for Page 5",$html);
break;
case "6.php":
$html.= "<div class=\"Banner6\"></div>";
$html=str_replace("#TITLE#","Title for Page 6",$html);
break;
default:
$html.= "<div class=\"Banner\"></div>";
$html=str_replace("#TITLE#","Title for Default Case Page",$html);
break;
}
}
else
$html.= "<div class=\"Banner\"></div>";
echo $html;
?>
<div id="ContentWrapper">
<?php
if(isset($_GET['Page']))
{
$page = "pages/";
$page .= $_GET['Page'];
if(is_file($page))
{
include($page);
}
else
{
include('pages/404.php');
}
}
else
{
include('pages/default.php');
}
?>
</div>
</div>
</body>
</html>