hi

Very simple problems, good to see ur getting the hang of it :)
the first is, you have defined your variables after you include the page, so
that the echo is outputting a blank variable...

so instead of:

<?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';
?>

make it

<?php
$statename = 'Alaska';
$postcode = 'ak';
$linkcode = 'world/na/us/ak';
php include ("../../../../includes/state/head.php");
echo '<meta name="mssmarttagspreventparsing" content="true" />';
include ("../../../../includes/javascript.php");
include ("../../../../includes/stylesheets.php");
\?>

i just changed the opening and closing tags a little (you didnt need so
many) but the main change is, now the variables come before the included
file, so that the include file can access those variables too.

echo's will work anywhere inside a <?php tag so, it will always output
something to the screen

no problems with search engines, if you use the meta tags and stuff u
usually use, itll work fine

javascript, stylesheets and stuff... the only thing to remember is all the
stylesheet files, and javascript files are relative to the final page
location, not to the include file location, but other than that its the same
as normal

hope that clears it up a bit :)

-- 
Luke
"Freedomware" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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 &gt; <?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

Reply via email to