Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: A question
04-07-2013, 02:12 PM #1
- Join Date
- Mar 2013
- Thanked 0 Times in 0 Posts
So I'm making a website and gonna use a same navigation bar,for instance i want nav and footer to stay there on all the pages, is it necessary to write header and footer code on all the pages?
04-07-2013, 03:37 PM #2
- Join Date
- Jan 2011
- Thanked 760 Times in 758 Posts
I use php to bring in these files. I make a header html doc with the doctype.. head and body tags(I use inline styling, but not necessary), then reduce it to something like this called header.html:Code:
<div style="width:280px;margin:auto;"> <h1>HELLO FOLKS!</h1> </div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<?php require ('header.html'); ?>
If you don't care if the rest of the pages loads when there is a problem with the header or footer files, use 'include' instead of 'require' in the php call.
Last edited by sunfighter; 04-07-2013 at 03:42 PM.Evolution - The non-random survival of random variants.
Because I love FLEXBOX and tired of waiting: http://davidwalsh.name/goodbye-vendor-prefixes