Forum Moderators: coopster
A basic question about php and the use of the include for navigation etc.
If one uses the "include" to put navigation and other elements that are the same on every page should one use html tags like <html>,<head> and <body> in the included file?
The output seems to be the same. Does anybody have comments about how this may affect the search engines when they scan the pages?
Hmmm...I commonly include <head> and <body> tags in includes. Allows for something like...
<?
$title = "page_title";
include("header.inc");
echo $copy;
include("footer.inc");
?>
...with header looking like
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?=$title;?></title>
</head>
<body>
<H!><?=$title;?></H1>
etc......
I use include() to reduce typing repetitive information, it only makes sense to me to use them for the tags that are on every page.
But yes, you have to make sure they only appear once.
WBF