Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 06-22-2012, 08:02 PM
SimpleMan's Avatar
Junior Member
 
Join Date: 05-10-12
Location: West Virginia
Posts: 24
iTrader: 0 / 0%
PHP Includes for header and footer

This is actually several questions.....

When using PHP includes for "header" files and "footer" files, when marking up the aforementioned files, it doesn't validate when you have doctype, <head>, etc on files. What is the customary way to markup the header and footer files so they validate?

I have simply the raw html and right now it looks fine. Is this the proper way of doing it?

Also, when search spiders crawl your site and you have it set up this way, will it index the header and footer files by themselves? Do you need to use robot.txt files to prohibit this from happening?
 
Reply With Quote
  #2 (permalink)  
Old 06-22-2012, 08:17 PM
HTMLBasicTutor's Avatar
Super Moderator
 
Join Date: 10-29-07
Location: British Columbia, Canada
Posts: 18,056
iTrader: 5 / 100%
Quote:
Originally Posted by SimpleMan View Post
When using PHP includes for "header" files and "footer" files, when marking up the aforementioned files, it doesn't validate when you have doctype, <head>, etc on files. What is the customary way to markup the header and footer files so they validate?
If you are trying to validate your pages "as is" they are not going to validate because you are missing the head section (assuming your doctype, character encoding etc. is in your include) and what ever closing tags you have in your footer include. I have a test fold on my web server where I upload the includes and pages, call up a page in the browser (which would be assembled) then validate.
Quote:
Originally Posted by SimpleMan View Post
Also, when search spiders crawl your site and you have it set up this way, will it index the header and footer files by themselves? Do you need to use robot.txt files to prohibit this from happening?
If you put your includes in a folder and an instruction in the robots.txt file for the bots to keep out then in theory that should work. You could put a blank HTML index page in the folder too just to be sure.
__________________

HTML Basic Tutor - Learn how to code for better SEO
Basic Computer Information - Computer & internet basics for website owners

SEO troubleshooting and review services available. - Pm me.
 
Reply With Quote
  #3 (permalink)  
Old 06-22-2012, 08:23 PM
SimpleMan's Avatar
Junior Member
 
Join Date: 05-10-12
Location: West Virginia
Posts: 24
iTrader: 0 / 0%
My "header.php" and "footer.php" now have no doctype or anything. They are simply: <div>content</div> ..... my "index.php" that has the includes now validates. So I should stick these included files in a folder of their own and prohibit crawling with robot.txt, correct? I will be fine doing this? Thanks for the quick reply btw.
 
Reply With Quote
  #4 (permalink)  
Old 06-22-2012, 08:31 PM
HTMLBasicTutor's Avatar
Super Moderator
 
Join Date: 10-29-07
Location: British Columbia, Canada
Posts: 18,056
iTrader: 5 / 100%
Yes to putting the includes in a folder. Don't forget to change the path to the includes in your pages.
__________________

HTML Basic Tutor - Learn how to code for better SEO
Basic Computer Information - Computer & internet basics for website owners

SEO troubleshooting and review services available. - Pm me.
 
Reply With Quote
  #5 (permalink)  
Old 06-30-2012, 01:15 PM
Member
Latest Blog:
None

 
Join Date: 06-28-12
Posts: 39
iTrader: 0 / 0%
or put dissalow for these files directly in your robots.txt. You can generate this file using Google Webmaster Tools
 
Reply With Quote
  #6 (permalink)  
Old 07-04-2012, 04:04 AM
Member
Latest Blog:
None

 
Join Date: 06-19-12
Location: india
Posts: 45
iTrader: 0 / 0%
Quote:
Originally Posted by SimpleMan View Post
My "header.php" and "footer.php" now have no doctype or anything. They are simply: <div>content</div> ..... my "index.php" that has the includes now validates. So I should stick these included files in a folder of their own and prohibit crawling with robot.txt, correct? I will be fine doing this? Thanks for the quick reply btw.
This will be the best information to create the "header.php" and "footer.php" with Doctype. But, you have to be aware of create the path files through in a particular one folder also be important.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Header & Footer Troubleshooting Help vbasic Coding Forum 2 09-23-2010 10:41 PM
How to make header and footer background go across whole page? MissTa Coding Forum 2 04-04-2010 09:44 AM
Putting my webpage header & footer around my forum Midwifery Online Coding Forum 4 10-13-2009 06:03 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 09:28 PM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.