Page 1 of 1

header/footer includes

Posted: Mon Mar 31, 2008 3:11 pm
by Todlerone
Hello everyone, I hope all is well and as per protocol thank-you in advance for any help/suggestions. My question this time is about making my baseball web site utilize includes for header, main and footer pages. Does anyone know of any good tutorials. I see some sites keep the <head> <title> and <body> tags in the header file and some don't. They use the ob_start() function. Not sure as to whicj one is better. I have read some sites use the GET function although I have read that this can sometimes cause problems with forms on a page(true?). Anyway thank-you for any help.

CHEERS

Re: header/footer includes

Posted: Mon Mar 31, 2008 5:30 pm
by s.dot
You will need to create your header file and a footer file. Then, it is as simple as this:

Code: Select all

//header file
require 'header.php';
 
echo 'Hi, im the index.php file!';
 
//footer file
require 'footer.php';
You then save that file as index.php and visit it in your browser. You'll then see your header, the page contents, and the footer.


This is how I do a lot of my sites, but a lot of people prefer a single point of access such as index.php?page=pagename.

That preference is up to you. :)

Did that help answer what you asked?