austinthompson Posted March 11, 2012 Share Posted March 11, 2012 I know I am probably complicating this but I am looking for a way to code a header and footer to the exterme top and extreme bottom of my pages. I have seen it before but I have no idea how to do it from scratch. But I ore or less want to be able to edit my header or footer one time and it work every where. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/258676-creating-repeating-headers-and-footers/ Share on other sites More sharing options...
trq Posted March 11, 2012 Share Posted March 11, 2012 Put your header and footer code in there own files then use include to include them. Quote Link to comment https://forums.phpfreaks.com/topic/258676-creating-repeating-headers-and-footers/#findComment-1326073 Share on other sites More sharing options...
austinthompson Posted March 11, 2012 Author Share Posted March 11, 2012 Insert Duh here... I can not believe I had to ask that question. The minute I read your answer I could feel the sleep deprivation making me dumber. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/258676-creating-repeating-headers-and-footers/#findComment-1326074 Share on other sites More sharing options...
austinthompson Posted March 11, 2012 Author Share Posted March 11, 2012 I do have an additional question... will google search and index the pages by the single header or do i need to make sure there is SEO material on every page? Quote Link to comment https://forums.phpfreaks.com/topic/258676-creating-repeating-headers-and-footers/#findComment-1326084 Share on other sites More sharing options...
dragon_sa Posted March 11, 2012 Share Posted March 11, 2012 By passing a page variable to each page you could have some code in your header script use that to change the information in the header based on the page loaded Quote Link to comment https://forums.phpfreaks.com/topic/258676-creating-repeating-headers-and-footers/#findComment-1326085 Share on other sites More sharing options...
redsmurph Posted March 11, 2012 Share Posted March 11, 2012 I tend to use a $page_title like so: $page_title = "Some nice page"; include 'header.php'; This then affects <title> some of the meta data and is also echoed as "<h1>" . htmlspecialchars($page_title) . "</h1>" If I don't set it, <title> become a generic site name, and no header title is shown for the page. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/258676-creating-repeating-headers-and-footers/#findComment-1326162 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.