Page 1 of 1

[SOLVED] Header / Footer

Posted: Mon Mar 21, 2005 3:51 pm
by Jim_Bo
Hi,

Im using index with require header footer for my site .. Im lost on how I can put data in the body of the index page (home) that doesnt show when other links are visited ..?

Code: Select all

<?php

require 'header.php';

switch ($_REQUEST['pages']) {

case 'contact_us':
	require 'contact_us.php';
	break;


case 'about_us':
	require 'about_us.php';
	break;

}

require 'footer.php';
 
?>
Thanks ..

Posted: Mon Mar 21, 2005 3:55 pm
by feyd
o.O :?:

Posted: Mon Mar 21, 2005 4:04 pm
by Jim_Bo
Hi,

Hmmz I thought that would be easy to understand .. thought it would be common code ..

I assume you understand the header footer side of the code ..

If I visit http://www.domain.com/index.php?pages=contact_us

I see the contact us form / details ..

If I goto http://www.domain.com .. the body is blank ..

I want to add data into the body of http://www.domain.com .. But in not sure how to get data into there without it displaying on all pages as you move around the links ..

Not sure how to explain it better that that really ..

Thanks ..

Posted: Mon Mar 21, 2005 4:09 pm
by hongco
Did you mean that if none of the case is selected, you wanted to display something on the body?

Code: Select all

require 'header.php';
 
switch ($_REQUEST['pages']) {
 
case 'contact_us':
    require 'contact_us.php';
    break;
 
case 'about_us':
    require 'about_us.php';
    break;

default:
   echo "this is when user a goes to http://www.yourdomain.com"; 
}
 
require 'footer.php';
PS: i really like the php highlight. I believe fedy wrote this part... very nice. First phpbb forums with php code i believe :) (sorry, it's offtopic)

Posted: Mon Mar 21, 2005 4:22 pm
by Burrito
that works, or you could create another page (your default page) and include it just as you're including your sub pages.

Code: Select all

require 'header.php';
 
switch ($_REQUEST['pages']) {
 
case 'contact_us':
    require 'contact_us.php';
    break;
 
case 'about_us':
    require 'about_us.php';
    break;

default:
   require 'default.php';
}
 
require 'footer.php';
Then you can put as much stuff in default.php as you would any other index.php page and not clutter up your index.php

Posted: Mon Mar 21, 2005 4:26 pm
by Jim_Bo
Hi,

Thanks guys .. so obvious .. I should have figured that one out :oops:

Thanks ..