Forum Moderators: not2easy
If you have php on your server (if you don't, I'd recommend finding a new host) then something like this ought to do the trick:
[pre] </head>
<body>
<?php include ("myIncludesDirectory/myHeaderFileName.php"); ?>
<!-- main contents here -->
<?php include ("myIncludesDirectory/myFooterFileName.php"); ?>
</body>
</html>[/pre]where myHeaderFileName.php and myFooterFileName.php can be written in 'regular' HTML but saved with a .php extension
<?php include('includes/doctype.php'); ?>
<html>
<head>
<?php include('includes/head.php'); ?>
</head>
<body>
<?php include('includes/header.php'); ?>
<!-- main contents here -->
<?php include('includes/footer.php'); ?>
</body>
</html>
doctype.php contains this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> head.php contains this:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="/includes/style.css" type="text/css" />
Does it have any effect on SEO? I.e. will the item that's getting called in get recognised by google etc?
I presume I just add the relevant tag to where abouts i want it included in the html i.e.
<div id="footer">
<?php include('includes/footer.php'); ?>
</div>
Does it have any effect on SEO? I.e. will the item that's getting called in get recognised by google etc?The Google-bots effectively read the page just the same way as a regular browser does...
If you go to a site that uses php includes and view the source code, you won't see (for example)
[pre]<div id="footer">
<?php include('includes/footer.php'); ?>
</div>
[/pre] instead you'll see something like
[pre]<div id="footer">
<p>
this is my footer
</p>
<p>
Copyright © 2006 ~ 2008
<a href="http://www.example.com/contact.html"
title="webmasters contact details">
Blue Widgets Inc</a>
~ All Rights Reserved
</p>
</div> [/pre] So... no... it does not have any effect on SEO
I presume I just add the relevant tag to where abouts i want it included in the html i.e.<div id="footer">
<?php include('includes/footer.php'); ?>
</div>
Yep
and you could incorporate the <div id="footer"> and </div> AND </body> and </html> into <?php include('includes/footer.php'); ?>... so then, you'd just write
<?php include('includes/footer.php'); ?>
and your page is finished
:)
[edited by: lavazza at 8:01 pm (utc) on Nov. 30, 2008]
Oh, and Terry, wait until you have 100+ pages, this will save you even more time ;-) I use that format on every site I build. And to think when I started I used Frontpage (it involved updating every page with the updated footer code). Ugh.