Re: combining a text sizer and text only link

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Store their current choice of text_only and/or text_size in $_SESSION.

http://php.net/session_start

//start the session:
session_start();
//use saved setting:
$text_only = isset($_SESSION['text_only']) ? $_SESSION['text_only'] : 0;
//override saved if they clicked on link and it's in GET:
$text_only = isset($_GET['text_only']) ? 1 : $text_only;
//save their current choice:
$_SESSION['text_only'] = $text_only;

Repeat all that (except the session_start) for all user preferences.

coo coo ka choo

On Tue, November 28, 2006 3:51 am, Ross wrote:
>
> $text_only = isset($_GET['text_only']) ? $_GET['text_only'] : 1;
>
>  if ($text_only==1) {
>  ?>
> <a href="<?php echo $_SERVER['PHP_SELF'];?>?text_only=0">off</a>
> // import css here
> <?
> }
> else {
> ?>
> <a href="<?php echo $_SERVER['PHP_SELF'];?>?text_only=1">on</a></span>
> // import css here
> <?
> }
> ?>
>
>
> secondly the text size links
>
>
> <a href="<? $_SERVER['PHP_SELF'];  ?>?text_size=medium" class="size1"
> id="one">A</a>
> <a href="<? $_SERVER['PHP_SELF']; ?>?text_size=larger" class="size2"
> id="two">A</a>
> <a href="<? $_SERVER['PHP_SELF']; ?>?text_size=largest" class="size3"
> id="three">A</a>
>
>
> <?
> $text_size = isset( $_REQUEST['text_size'] ) ? $_REQUEST['text_size']
> : '';
>
> switch ($text_size) {
> case "medium":
> ?>
> <link href="css/medium.css" rel="stylesheet" type="text/css" />
> <?
> break;
> case "larger":
> ?>
> <link href="css/larger.css" rel="stylesheet" type="text/css" />
> <?
> break;
> case "largest":
> ?>
> <link href="css/largest.css" rel="stylesheet" type="text/css" />
> <?
> break;
> }
> ?>
>
> these work great independently but when I use one the other switches
> off.
> any ideas how I can combine them?
>
>
> Ross
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux