RE: [PHP] PHP Includes and Echoes in Head Sections and Search Engines
| From: | Arthur Pelkey | Date: | Thu, 15 Jan 2004 21:06:44 +0000 |
| Subject: | RE: [PHP] PHP Includes and Echoes in Head Sections and Search Engines | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174707@lists.php.net to get a copy of this message | ||
You are defining the vars after the header/title has already been
processed, put it before the head.php, and it should work
-----Original Message-----
From: Freedomware [mailto:david_blomstrom@yahoo.com]
Sent: Thursday, January 15, 2004 3:54 PM
To: php-general@lists.php.net
Subject: [PHP] PHP Includes and Echoes in Head Sections and Search
Engines
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php