[thelist] Multiple PHP Varialbes and Single Quote Syntax Question

Jono Jono at charlestonwebsolutions.com
Sun Dec 3 22:16:45 CST 2006

Rick den Haan wrote:
> Jono,
> Personally, I'd recommend using a switch[1] in this case, though. You 
> can read more about it on the PHP.net website, but here's the basics in 
> your situation:
> <?php
> switch($filename)
> {
>     case 'cool-site.php':
>         $parent = 'cool-site.php';
>         $thisPage = 'Cool Site';
>         $PageHeader = 'Cool Site Header Text Here';
>     break;
> }
> ?>
> Repeat everything from case to break for each page. Just keep it within 
> the curly brackets.
This is great, just what I had in mind.  If I break something I may come 
back to you for help.  So far, syntax coloring in Dreamweaver leads me 
to believe I am in good shape at this point.
> $PageHeader = "Cool Site's Header Text Here";
> $PageHeader = 'Cool Site\'s Header Text Here';
OK, got this working just after I hit send; I didn't realize I had mixed 
in " and ' until I went back and looked one ore time.  I went with the 
second of the two "CORRECT" examples above.
> No problem. I would recommend staying clear of the short open tags, 
> though. Try to use "<?php" instead of just "<?". For one thing, PHP 6 
> will no longer support the short form (can't find the source at the 
> moment). For another, not all webservers running PHP 4 or 5 have the 
> option enabled. It can also be confusing with XML-declarations, as they 
> have the form of "<?xml".
> Rick.
Good advise, thanks.  I read about this in SAMS Teach Yourself PHP, 
MySQL and Apache in 24 Hours - can't remember if they recommend one way 
or the other.  I will stick to "<?php" as it makes good 
sense...especailly with "<?xml" likely lurking in the near future for me.

Thanks again,

Jono Young
../Designer ../Developer ../Illustrator
Charleston Web Solutions
Bringing Higher Standards to the Lowcountry

More information about the thelist mailing list