Active page selected change navigation

If you go to: http://rksdesignstudios.com/clients/cvcompost/ - The top navigation I am trying to make it for if you select "Contact" Then use another image like a black background instead.

To show that you are currently on that page, my navigation is set up below in the code snippet box. And my PHP navigation I use is below as well underneath the navigation code.

What I mean by PHP navigation is using header/footer and then place content in between. (?p=contact)

Any ideas on what I can do? I have seen CSS examples before but this is different? I think...

Thank you,

Ryan

<a href="?p=ccovers"><img src="images/navCovers.gif" width="93" height="42" alt="navHome" class="noHover" /></a>
                                <a href="?p=odorcover"><img src="images/navOdor.gif" width="152" height="42" alt="navOdor" class="noHover" /></a>
                                <a href="?p=windermachine"><img src="images/navWinderMachines.gif" width="136" height="42" alt="navWinderMachines" class="noHover" /></a>
                                <a href="?p=compost"><img src="images/navCompost.gif" width="96" height="42" alt="navCompost" class="noHover" /></a>
                                <a href="?p=customcompost"><img src="images/navCustom.gif" width="105" height="42" alt="navCustom" class="noHover" /></a>
                                <a href="?p=about"><img src="images/navAbout.gif" width="96" height="42" alt="navAbout" class="noHover" /></a>
                                <a href="?p=contact"><img src="images/navContact.gif" width="98" height="42" alt="navContact" class="noHover" /></a>
 
 
CODE FOR PHP NAVIGATION:
 
<?php
if (!empty($_GET['p']) && file_exists(basename($_GET['p']) . '.php')) {
    $page = basename($_GET['p']) . '.php';
} else if (empty($_GET['p'])) {
    $page = 'default.php';
} else {
   $page = '404.php';
}
 
if ($page=='default.php') {
    $header='header';
} else {
    $header='header';
}
 
include $header.".php";    
include $page;
include "footer.php";
?>

Open in new window

LVL 1
catonthecouchproductionsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dr_dedoCommented:
there is a simple way to do that
u can make a function that draws header, and that function takes as an argument the page u need to highlight, here is an example. making stuff in array really ease things.
i hope this code show you what i mean
<?
function drawHeader ($opt){
$array = array(
array('title'=>'ccovers1','src'=>'images/navCovers.gif','width'=>93,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCovers_black.gif'),
array('title'=>'ccovers1','src'=>'images/navCovers.gif','width'=>93,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCovers_black.gif'),
array('title'=>'ccovers1','src'=>'images/navCovers.gif','width'=>93,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCovers_black.gif'),
array('title'=>'ccovers5','src'=>'images/navCovers.gif','width'=>93,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCovers5_black.gif'),
array('title'=>'ccovers1','src'=>'images/navCovers.gif','width'=>93,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCovers_black.gif'),
)	;
foreach ($array as $x){
	if ($x['title']==$opt) $x['src']= $x['alt_src'];
	echo "<a href='?p={$x['title']}'><img src='{$x['src']}' width='{$x['width']}' height='{$x['height']}' alt='{$x['alt']}' class='{$x['class']}' /></a>\n";
}
}
drawHeader ('ccovers5');
?>

Open in new window

0
catonthecouchproductionsAuthor Commented:
Thank you! So let me just try to interpt this sorry if it sounds repetitive to what you said.

Each item in the array is each of the nav buttons and then you place them each back to form the <img> HTML tag

So when I want to run it I call the drawHeader(); function? Correct? You have:

drawHeader ('ccovers5');

So when this is parsed it will output that location in the array? The image?

I am confused on how it will look like in my code.

Thank you for your time,

Ryan
0
dr_dedoCommented:
in your code, to add the header to a page, u add this
include $header.".php";

all you'll do is to add this instead
drawHeader ('ccovers5');

this will do the very same thing as just including the header plus it will emphathize the title you sent to the function. here, it will use the alternative image of ccovers5

you have to supply each element of the array with relevant data, and an alternative image that you want it "on" when page is active.

i could do the whole items in the array, but it is so many copy and paste, so i sent u some sample data
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

catonthecouchproductionsAuthor Commented:
I have my header include in my index.php which is below. I am confused  on that part.

So where you have the arrray elements, i just change the values to match and BOOM golden. I noticed how:

array('title'=>'ccovers1','src'=>'images/navCovers.gif','width'=>93,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCovers_black.gif'),


How you have "src" and "alt_src"

SRC - the none selected
ALT_SRC - the selected

Correct?

Will I keep my existing navigation where it is? On the header.php at the top. Sorry for the questions just trying to get an understanding.

You posted: drawHeader ('ccovers5');

When you call that, it will draw that img correct?
<?php
if(!empty($_GET['p']) && file_exists(basename($_GET['p']) . '.php')){
    $page = basename($_GET['p']) . '.php';
}
else if(empty($_GET['p'])){
    $page = 'default.php';
}else{
    $page = '404.php';
}
 
if($page=='default.php'){
    $header='header';
}else{
    $header='header';
}
include $header.".php";    
include $page;
include "footer.php";
?>

Open in new window

0
dr_dedoCommented:
you are right, that's the idea. but the function will not only print the image, it will print all the header stuff and give the selected page its proper image (alt_src)
all non selected pages will use src but the selected one will use alt_src which will make the user feel that this page is active. you can implement it in your code this way
<?php
if(!empty($_GET['p']) && file_exists(basename($_GET['p']) . '.php')){
$p =   $_GET['p']  
$page = basename($_GET['p']) . '.php';
}
else if(empty($_GET['p'])){
    $page = 'default.php';
}else{
    $page = '404.php';
}
 
if($page=='default.php'){
    $header='header';
}else{
    $header='header';
}
include $header.".php"; 
drawHeader ($p);   
include $page;
include "footer.php";
?>

Open in new window

0
catonthecouchproductionsAuthor Commented:
Ahh..thank you! Becoming more and more clear as we go :) Another question, how does it know to use alt_src? At this line?

   if ($x['title']==$opt) $x['src']= $x['alt_src'];

Below is my new function with the new data below and also my index.php page with the function call.

When I go to my site now, loading the "index.php" page nothing shows any idea why? No errors as well.

Thanks,

Ryan
<?php
function drawHeader ($opt){
    $array = array(
    array('title'=>'ccovers1','src'=>'images/navCovers.gif','width'=>93,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCovers_black.gif'),
    array('title'=>'ccovers1','src'=>'images/navOdor.gif','width'=>152,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navOdor_black.gif'),
    array('title'=>'ccovers1','src'=>'images/navWinderMachines.gif','width'=>136,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navWinderMachines_black.gif'),
    array('title'=>'ccovers5','src'=>'images/navCompost.gif','width'=>96,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCompost_black.gif'),
    array('title'=>'ccovers1','src'=>'images/navCustom.gif','width'=>105,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCustom_black.gif'),
    )       ;
    array('title'=>'ccovers1','src'=>'images/navAbout.gif','width'=>96,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navAbout_black.gif'),
    )       ;
    array('title'=>'ccovers1','src'=>'images/navContact.gif','width'=>98,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navContact_black.gif'),
    )       ;
    foreach ($array as $x){
        if ($x['title']==$opt) $x['src']= $x['alt_src'];
        echo "<a href='?p={$x['title']}'><img src='{$x['src']}' width='{$x['width']}' height='{$x['height']}' alt='{$x['alt']}' class='{$x['class']}' /></a>\n";
    }   
}
 
 
INDEX.PHP
 
 
<?php
// call function for active page
include "drawHeader.php";
 
if(!empty($_GET['p']) && file_exists(basename($_GET['p']) . '.php')){
$p =   $_GET['p']  
$page = basename($_GET['p']) . '.php';
}
else if(empty($_GET['p'])){
    $page = 'default.php';
}else{
    $page = '404.php';
}
 
if($page=='default.php'){
    $header='header';
}else{
    $header='header';
}
include $header.".php"; 
drawHeader ($p);   
include $page;
include "footer.php";
?>

Open in new window

0
dr_dedoCommented:
you should change ccovers1 to different page link names, e.g. ccovers, odorcover, windermachine etc...
0
catonthecouchproductionsAuthor Commented:
Ohh..those are for the page names! Thank you, i missed that. That would fill in the gap. I thought i found my problem, i added a ";" at the $ p xxxxx part. But still a blank page.
<?php
// call function for active page
include "drawHeader.php";
 
if(!empty($_GET['p']) && file_exists(basename($_GET['p']) . '.php')){
$p    =   $_GET['p'];  
$page = basename($_GET['p']) . '.php';
}
else if(empty($_GET['p'])){
    $page = 'default.php';
}else{
    $page = '404.php';
}
 
if($page=='default.php'){
    $header='header';
}else{
    $header='header';
}
include $header.".php"; 
drawHeader ($p);   
include $page;
include "footer.php";
?>

Open in new window

0
catonthecouchproductionsAuthor Commented:
I changed up the titles, my new code is below for the function you gave me. Still not showing my page.
<?php
function drawHeader ($opt){
    $array = array(
    array('title'=>'ccovers','src'=>'images/navCovers.gif','width'=>93,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCovers_black.gif'),
    array('title'=>'odorcover','src'=>'images/navOdor.gif','width'=>152,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navOdor_black.gif'),
    array('title'=>'windermachine','src'=>'images/navWinderMachines.gif','width'=>136,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navWinderMachines_black.gif'),
    array('title'=>'compost','src'=>'images/navCompost.gif','width'=>96,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCompost_black.gif'),
    array('title'=>'customcompost','src'=>'images/navCustom.gif','width'=>105,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCustom_black.gif'),
    )       ;
    array('title'=>'about','src'=>'images/navAbout.gif','width'=>96,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navAbout_black.gif'),
    )       ;
    array('title'=>'contact','src'=>'images/navContact.gif','width'=>98,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navContact_black.gif'),
    )       ;
    foreach ($array as $x){
        if ($x['title']==$opt) $x['src']= $x['alt_src'];
        echo "<a href='?p={$x['title']}'><img src='{$x['src']}' width='{$x['width']}' height='{$x['height']}' alt='{$x['alt']}' class='{$x['class']}' /></a>\n";
    }   
}
?>

Open in new window

0
dr_dedoCommented:
what do you have in header.php ? can you send code ?
0
catonthecouchproductionsAuthor Commented:
Below is the code for my header.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>CV Compost</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="cvcdata.js" type="text/javascript"></script>
<script type="text/javascript">
		var today = new Date();
		var month = today.getMonth() + 1;
		var day = today.getDate();
		var year = today.getFullYear();
		var s = "/";
		var todaystr  = month + s + day + s + year;
		
		function checkform(){
		
			var	name = document.quote_form.name.value;
			var email = document.quote_form.email.value;
			var phone = document.quote_form.phone.value;
			var address1 = document.quote_form.address1.value;
			var city  = document.quote_form.city.value;
			var state = document.quote_form.state.value;
			var zip = document.quote_form.zip.value;
			var company = document.quote_form.company.value;
				
			if(address1 == ""){
				alert("Please enter a street address.");
				document.quote_form.address1.focus();
						} else if(city == ""){
				alert("Please enter a city.");
				document.quote_form.city.focus();
				
			}	else if(company == ""){
				alert("Please enter a Company Name.");
				document.quote_form.company.focus();	
			} else if(state == ""){
				alert("Please enter a state.");
				document.quote_form.state.focus();
			} else if(zip == ""){
				alert("Please enter a zip code.");
				document.quote_form.zip.focus();				
			} else if(name == ""){
				alert("Please enter your name.");
				document.quote_form.name.focus();
			} else if(phone == ""){
				alert("Please enter a phone number.");
				document.quote_form.phone.focus();
			} else if(email == ""){
				alert("Please enter an email address.");
				document.quote_form.email.focus();
			} else {
				document.quote_form.submit();
			}
		
		} 
</script>
</head>
<body onload="document.quote_form.quote_date.value=todaystr;">
<div id="wrapper">
        <div id="innerWrap">
        	<div class="centeralignheader"> 
            	<div id="header">
                	<a href="index.php"><img src="images/header.gif" width="222" height="82" alt="cvCompostLogo" /></a>
                </div>
                                <a href="?p=ccovers"><img src="images/navCovers.gif" width="93" height="42" alt="navHome" class="noHover" /></a>
                                <a href="?p=odorcover"><img src="images/navOdor.gif" width="152" height="42" alt="navOdor" class="noHover" /></a>
                                <a href="?p=windermachine"><img src="images/navWinderMachines.gif" width="136" height="42" alt="navWinderMachines" class="noHover" /></a>
                                <a href="?p=compost"><img src="images/navCompost.gif" width="96" height="42" alt="navCompost" class="noHover" /></a>
                                <a href="?p=customcompost"><img src="images/navCustom.gif" width="105" height="42" alt="navCustom" class="noHover" /></a>
                                <a href="?p=about"><img src="images/navAbout.gif" width="96" height="42" alt="navAbout" class="noHover" /></a>
                                <a href="?p=contact"><img src="images/navContact.gif" width="98" height="42" alt="navContact" class="noHover" /></a>
        </div>
        </div>
 
		

Open in new window

0
dr_dedoCommented:
try this, it is both files, one is the header and the other is that one which calls header
//================ header.php
<?php
$p = isset($_GET['p']) ? $_GET['p'] : '';
function drawHeader ($opt){
    $array = array(
    array('title'=>'ccovers','src'=>'images/navCovers.gif','width'=>93,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCovers_black.gif'),
    array('title'=>'odorcover','src'=>'images/navOdor.gif','width'=>152,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navOdor_black.gif'),
    array('title'=>'windermachine','src'=>'images/navWinderMachines.gif','width'=>136,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navWinderMachines_black.gif'),
    array('title'=>'compost','src'=>'images/navCompost.gif','width'=>96,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCompost_black.gif'),
    array('title'=>'customcompost','src'=>'images/navCustom.gif','width'=>105,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCustom_black.gif'),
    array('title'=>'about','src'=>'images/navAbout.gif','width'=>96,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navAbout_black.gif'),
    array('title'=>'contact','src'=>'images/navContact.gif','width'=>98,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navContact_black.gif'),
    );
    foreach ($array as $x){
        if ($x['title']==$opt) $x['src']= $x['alt_src'];
        echo "<a href='?p={$x['title']}'><img src='{$x['src']}' width='{$x['width']}' height='{$x['height']}' alt='{$x['alt']}' class='{$x['class']}' /></a>\n";
    }   
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>CV Compost</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="cvcdata.js" type="text/javascript"></script>
<script type="text/javascript">
		var today = new Date();
		var month = today.getMonth() + 1;
		var day = today.getDate();
		var year = today.getFullYear();
		var s = "/";
		var todaystr  = month + s + day + s + year;
		
		function checkform(){
		
			var	name = document.quote_form.name.value;
			var email = document.quote_form.email.value;
			var phone = document.quote_form.phone.value;
			var address1 = document.quote_form.address1.value;
			var city  = document.quote_form.city.value;
			var state = document.quote_form.state.value;
			var zip = document.quote_form.zip.value;
			var company = document.quote_form.company.value;
				
			if(address1 == ""){
				alert("Please enter a street address.");
				document.quote_form.address1.focus();
						} else if(city == ""){
				alert("Please enter a city.");
				document.quote_form.city.focus();
				
			}	else if(company == ""){
				alert("Please enter a Company Name.");
				document.quote_form.company.focus();	
			} else if(state == ""){
				alert("Please enter a state.");
				document.quote_form.state.focus();
			} else if(zip == ""){
				alert("Please enter a zip code.");
				document.quote_form.zip.focus();				
			} else if(name == ""){
				alert("Please enter your name.");
				document.quote_form.name.focus();
			} else if(phone == ""){
				alert("Please enter a phone number.");
				document.quote_form.phone.focus();
			} else if(email == ""){
				alert("Please enter an email address.");
				document.quote_form.email.focus();
			} else {
				document.quote_form.submit();
			}
		
		} 
</script>
</head>
<body onload="document.quote_form.quote_date.value=todaystr;">
<div id="wrapper">
        <div id="innerWrap">
        	<div class="centeralignheader"> 
            	<div id="header">
                	<a href="index.php"><img src="images/header.gif" width="222" height="82" alt="cvCompostLogo" /></a>
                </div>
                                <?php echo drawHeader ($p)?>
        </div>
        </div>
 
        
//===== the other page        
<?php
// call function for active page
if(!empty($_GET['p']) && file_exists(basename($_GET['p']) . '.php')){
$p    =   $_GET['p'];  
$page = basename($_GET['p']) . '.php';
}
else if(empty($_GET['p'])){
    $page = 'default.php';
}else{
    $page = '404.php';
}
 
if($page=='default.php'){
    $header='header';
}else{
    $header='header';
}
include $header.".php?p=$p"; 
include $page;
include "footer.php";
?>

Open in new window

0
catonthecouchproductionsAuthor Commented:
Thank you! When using that, I get no CSS styling and none of the header navigation buttons.

Ryan
0
dr_dedoCommented:
OK, my fault, try this
// header file
<?php
function drawHeader ($opt){
    $array = array(
    array('title'=>'ccovers','src'=>'images/navCovers.gif','width'=>93,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCovers_black.gif'),
    array('title'=>'odorcover','src'=>'images/navOdor.gif','width'=>152,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navOdor_black.gif'),
    array('title'=>'windermachine','src'=>'images/navWinderMachines.gif','width'=>136,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navWinderMachines_black.gif'),
    array('title'=>'compost','src'=>'images/navCompost.gif','width'=>96,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCompost_black.gif'),
    array('title'=>'customcompost','src'=>'images/navCustom.gif','width'=>105,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navCustom_black.gif'),
    array('title'=>'about','src'=>'images/navAbout.gif','width'=>96,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navAbout_black.gif'),
    array('title'=>'contact','src'=>'images/navContact.gif','width'=>98,'height'=>42,'alt'=>'navHome','class'=>'noHover','alt_src'=>'images/navContact_black.gif'),
    );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>CV Compost</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="cvcdata.js" type="text/javascript"></script>
<script type="text/javascript">
		var today = new Date();
		var month = today.getMonth() + 1;
		var day = today.getDate();
		var year = today.getFullYear();
		var s = "/";
		var todaystr  = month + s + day + s + year;
 
		function checkform(){
 
			var	name = document.quote_form.name.value;
			var email = document.quote_form.email.value;
			var phone = document.quote_form.phone.value;
			var address1 = document.quote_form.address1.value;
			var city  = document.quote_form.city.value;
			var state = document.quote_form.state.value;
			var zip = document.quote_form.zip.value;
			var company = document.quote_form.company.value;
 
			if(address1 == ""){
				alert("Please enter a street address.");
				document.quote_form.address1.focus();
						} else if(city == ""){
				alert("Please enter a city.");
				document.quote_form.city.focus();
 
			}	else if(company == ""){
				alert("Please enter a Company Name.");
				document.quote_form.company.focus();
			} else if(state == ""){
				alert("Please enter a state.");
				document.quote_form.state.focus();
			} else if(zip == ""){
				alert("Please enter a zip code.");
				document.quote_form.zip.focus();
			} else if(name == ""){
				alert("Please enter your name.");
				document.quote_form.name.focus();
			} else if(phone == ""){
				alert("Please enter a phone number.");
				document.quote_form.phone.focus();
			} else if(email == ""){
				alert("Please enter an email address.");
				document.quote_form.email.focus();
			} else {
				document.quote_form.submit();
			}
 
		}
</script>
</head>
<body onload="document.quote_form.quote_date.value=todaystr;">
<div id="wrapper">
        <div id="innerWrap">
        	<div class="centeralignheader">
            	<div id="header">
                	<a href="index.php"><img src="images/header.gif" width="222" height="82" alt="cvCompostLogo" /></a>
                </div>
                                <?php
                                foreach ($array as $x){
        if ($x['title']==$opt) $x['src']= $x['alt_src'];
        echo "<a href='?p={$x['title']}'><img src='{$x['src']}' width='{$x['width']}' height='{$x['height']}' alt='{$x['alt']}' class='{$x['class']}' /></a>\n";
    }
    ?>
        </div>
        </div>
<?
}
?>
 
// the other file
<?php
// call function for active page
if(!empty($_GET['p']) && file_exists(basename($_GET['p']) . '.php')){
$p    =   $_GET['p'];  
$page = basename($_GET['p']) . '.php';
}
else if(empty($_GET['p'])){
    $page = 'default.php';
}else{
    $page = '404.php';
}
 
if($page=='default.php'){
    $header='header';
}else{
    $header='header';
}
include $header.".php";
drawHeader($p); 
include $page;
include "footer.php";
?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
catonthecouchproductionsAuthor Commented:
Like the method that you used with this! I never thought of using arrays, i will keep this in mind, arrays are nife to work with with data like that!

Worked great!

Thank you so much!

Ryan
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.