PHP Includes and Echoes in Head Sections and Search Engines
| From: | Freedomware | Date: | Thu, 15 Jan 2004 20:53:52 +0000 |
| Subject: | PHP Includes and Echoes in Head Sections and Search Engines | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-174701@lists.php.net to get a copy of this message | ||
I'm having a blast with PHP includes and echo functions; I never dreamed they could be so simple and effective. But I have a couple questions relating to head sections and search engines.
Consider the following html code:
<!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" xml:lang="en" lang="en">
<head>
<?php include ("../../../../includes/state/head.php"); ?>
<meta name="mssmarttagspreventparsing" content="true" />
<?php include ("../../../../includes/javascript.php"); ?>
<?php include ("../../../../includes/stylesheets.php"); ?>
<?php
$statename = 'Alaska';
$postcode = 'ak';
$linkcode = 'world/na/us/ak';
?>
</head>
<body>
Welcome to <?php echo "$statename" ?>!
* * * * * * * * * *
And here's the html code from the include named head.php:
<?php
$todayDate = date("m-d-Y");
?>
<title>Freedomware > <?php echo "$statename" ?></title>
<meta name="description" content="<?php echo "$statename" ?> versus Microsoft" />
<meta name="keywords" content="Alaska, Microsoft, Microshaft, Linux, Bill Gates, corporate corruption" />
* * * * * * * * * *
I discovered that includes will apparently work just about anywhere, but echo functions apparently don't work with the <title> tag and meta tags; at least, I can't see the word "Alaska" in those locations when I click View Source in my browser.
So I wondered if there IS a way to make echo functions work in meta tags.
Also, do you know if text derived from includes causes any problems with search engines? My guess is no, because I can see the included words just fine when I click View Source.
Along similar lines, I wondered if there might be potential pitfalls if you import links to style sheets and javascripts as includes. Everything seems to work just fine so far.
Thanks.