English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi there,

I'm running a site and I'm currently using iframes as my main source to load different pages on to the index page. I'm getting sick of using iframes and would like to move on to something easier to maintain.

I've looked around and found only a few sites that actually explain the uses of header and footer, but it still doesn't explain how to actually put it to use. If someone could give me a link or a tutorial on how to properly code using the header and footer inc. php coding I would be forever grateful.

I'm actually looking for a very thorough tutorial specifically, because I've seen sites that just explain what it is but not actually explaining what codes you need and where to exactly put the header and footer codes with your index page. So kind of like a thorough step by step process would work perfectly.

If anyone could help out I would be so grateful. Its hard for me because I really have no one to teach me how to use this kind of coding. I really appreciate it.

2007-07-30 09:20:24 · 6 answers · asked by pg67aw 2 in Computers & Internet Programming & Design

6 answers

Well in php it is basically very easy.
Make a file for your header call it header.php or header.html etc.

Make a file for your footer call it footer.php or footer.html

Then at the top of the pages, after the body statement.





PUT the rest of your HTML here for your indexpage or whateverpage





Save it as a php page and that will include the two files.
If you named the header header.html

Load those pages to your server and open the page they will be on it.
You can even make the head a txt file etc but html or php is usually easier. Those pages only need the html that would be in the body do not make an entire page just what you want inserted. (IE Skip

dont use them for the html on these pages!)

ADDED -- here is a starting tutorial for you
http://allyourtech.com/content/articles/22_11_2005_php_includes_for_people_who_dont_know_php.php

http://www.christopherjason.com/articles/using-php-includes/

2007-07-30 09:31:02 · answer #1 · answered by Tracy L 7 · 1 0

Php Include Header

2016-11-13 21:37:40 · answer #2 · answered by Anonymous · 0 0

Using headers and footers is actually quite easy. You first decide what you want to be carried over into each page, such as the logo and menus. Take that and put in into a separate file and upload into a folder such as inc (short for includes).

Now, replace that section you have in the other file with:


The @ suppresses errors. Leave off during testing. Remember to remove spaces in the include line.

Repeat for the footer section.

If you will be using the includes inside folders, replace the line above with this:
@include( $_SERVER[" DOCUMENT_ROOT" )." /inc/header.inc.php "); ?>

2007-07-30 09:55:32 · answer #3 · answered by Anonymous · 1 0

It's not exactly thourough but..

You gotta make the header and footer files(like header.php and footer.php).. On header, it should be like:



((this is optional.. only if you have a external stylesheet you want on the page))
WEBSITE NAME

(or just put the sidebar there)



Just pretty much the layout code. No content or anything, unless you want that content to be on every page

And the footer should be just whatever you want below the content of the page..

Then on each page you should have this:


Content Here


And all your pages should be php. For example, instead of home.html of home.htm, make it home.php

Hope this helped!

2007-07-30 09:39:29 · answer #4 · answered by Anonymous · 0 0

If you're using PHP, let me introduce you to the concept of templates.

Now, to get your started, maybe some of these articles at www.phpbuilder.com might be useful and a good introduction to templates.
http://www.phpbuilder.com/columns/index.php3?cat=3&subcat=35

You can have a read thru all the articles, the one you might be interested in is the Smarty Templating System
http://www.phpbuilder.com/columns/ben_robinson20070413.php3?aid=1320

Next you might want to try out Smarty Templates at http://smarty.php.net/ and read the crash course
http://smarty.php.net/crashcourse.php

I swear, once you get into this template stuff, you'll never approach HTML site creation in the same way again. This is the best way to separate the content from the presentation, and guarantees an easy to maintain website.

have fun

2007-07-30 22:37:59 · answer #5 · answered by diagnostix 3 · 0 0

this is a good tutorial for php dynamic includes: http://blinding-light.com/tutorials/read/7
use dynamic includes if you want those nice query strings

2007-07-30 15:17:11 · answer #6 · answered by amy 3 · 0 0

fedest.com, questions and answers