Re: Setting a global variable
| From: | CF High | Date: | Tue, 20 May 2003 22:31:13 +0000 |
| Subject: | Re: Setting a global variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148308@lists.php.net to get a copy of this message | ||
Sure.
If you're using a global includes page in each of your site pages, just
check whether or not the variable exists within your includes page.
For example, global_vars.php, or whatever you want to name it, would be
included at the top of each page in your site and would contain the
following simple code snippet:
<? if (!$VARIABLE_TO_SET) { $VARIABLE_TO_SET = some_value_here; } ?>
There are I'm sure more elegant solutions, but this will do the trick if
you're looking for a quick and easy solution........
--Noah
"Don" <donpro@lclcan.com> wrote in message
news:006601c31f04$526a3c10$c889cdcd@enterprise...
> Hi,
>
> Is there a way to set a PHP variable the first time a user enters a
website
> that will remain global throughout the entire site but does not use
> sessions? It also does not depend on which page the user loads first
(home
> page or some other page from the web site)
>
> Thanks,
> Don
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.483 / Virus Database: 279 - Release Date: 5/19/2003
>
>