Page Header script was created to generate HTTP responses and HTML page headers, It renders HTTP response header for several purposes like force downloading files, avoiding page caching or adding any arbitrary headers.
This function allows us to define raw HTTP headers as a string. The script will then execute those headers and force the browser to render the page accordingly.
The thing we don’t like about flat HTML files is you need to repeat the same HTML code throughout your website. There are ways around this such as using Dreamweaver templates but our preferred method is to move the common HTML code into separate files header.php and footer.php. See tutorial below.
Headers list – Jump straight to:
301 moved permanently
302 moved temporarily
404 page not found
Service not available
Force browsers not to cache pages
The include() function takes all the content in a specified file and includes it in the current file.
This enabled you to call a header function anywhere on the page, the syntax to use is very simply at the very top of the file open PHP then type ob_start() this turns out output buffering.
You can redirect your user to some other page.
You can prevent the browser to cache pages by using the following code.
You can generate different types of data other than HTML, for example, you can parse an image, psd, zip etc from PHP.
A simple tutorial that will show you how to use PHP to create a common header and footer file for your website, and how to use them properly.
In this tutorial we are going to go through how to add your own, customize the header to make it taller and change your text colour. For this tutorial we are using the Default BuddyPress 1.2 theme.