On Sat, Jun 7, 2008 at 11:33 PM, Hayden's Harness Attachment
<[EMAIL PROTECTED]> wrote:
> Phill
>
> Thank you. I am such a newbie to all of this I would not be suprised if I am 
> messing up. In my header I have a default fontsize "layout_medium" and the 
> following PHP code in My header.
>
> <?php
> if ((!$sitestyle) || $sitestyle == 'layout_small') { echo '<a 
> class="switch_small" 
> href="http://choroideremia.org/switcher.php?set=layout_small";>Make Font Size 
> Smaller</a>';
> }
> else {
>  echo '<a class="switch_large"
> href="http://choroideremia.org/switcher.php?set=layout_large";>Make Font Size 
> Larger</a>';
> }
> ?>
>
> I am trying to use PHP to create a cookie that chooses from the default font 
> size (layout_medium), button one "Make Font Size Smaller"(layout_small) and 
> button two "Make Font Size Larger" (layout_large).
>

Hi Angus,

I believe that your problem is not in the setting code above but
instead in the output of your <link /> as shown here:

<link rel="stylesheet" type="text/css" media="screen" title="Default
font size" href="<?php echo (!$sitestyle)?'layout_medium'ß:$sitestyle
?>.css" />

It looks fine, except for the ß though perhaps consider the following
alternative...

switch ($sitestyle) {
    default:
        $sitestyle = empty($_SESSION['sitestyle']) ? 'layout_medium' :
$_SESSION['sitestyle'];
    case 'layout_medium':
    case 'layout_large':
    case 'layout_small':
        echo '<link rel="stylesheet" type="text/css" media="screen"
href="'. $sitestyle .'.css" />';
        $_SESSION['sitestyle'] = $sitestyle;
    break;
}

This should provide some extra security to prevent people from trying
to load up *anything* by passing it in.

Phill

Reply via email to