[thelist] Multiple PHP Varialbes and Single Quote Syntax Question

Jono Jono at charlestonwebsolutions.com
Sun Dec 3 08:28:49 CST 2006

I am working to set up a Pseudo database file (named pseudo.php) for 
managing navigation selected states, file paths, page titles, files 
names, etc.  as follows:

<? $filename=basename($_SERVER['PHP_SELF']);

// 'Cool Site' page variables go here
if ($filename=='cool-site.php')
    { $parent = 'cool-site.php'; }
if ($filename =='cool-site.php')
    { $thisPage = 'Cool Site'; }
if ($filename =='cool-site.php')
    { $PageHeader = 'Cool Site Header Text Here'; }

I will then place the following in my HTML templates:

<? $path=''; include $path.'includes/pseudo.php'; ?>
<title><? echo ("$thisPage") ?></title>
<h1><? echo ("$PageHeader") ?></h1>


1. I would like to add a few more variables to this code but am 
wondering if there is a more efficient way to write this?

Would this work?:

<? if ($filename=='cool-site.php')
        {$parent = 'cool-site.php'; && $thisPage = 'Cool Site'; && 
$PageHeader = 'Cool Site Header Text Here'; }

 - -

2.  I need a little help with escaping a single quote used for 
possession, in my Pseudo PHP database.  How would I correctly write 
"Site's" in PHP?

Is this correct?:

if ($filename =='cool-site.php')
    { $PageHeader = "Cool Site\'s Header Text Here'; }

Any tips or help are appreciated.  I am still learning my around basic PHP.


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

More information about the thelist mailing list