Re: Having problems with an IF statement, just doesn't make sense
| From: | David Otton | Date: | Sun, 06 Jul 2003 17:45:29 +0000 |
| Subject: | Re: Having problems with an IF statement, just doesn't make sense | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154137@lists.php.net to get a copy of this message | ||
On Mon, 7 Jul 2003 10:18:04 -0700, you wrote:
>if (isset($theme)) {
> print("Current theme is $theme");
> require "content/header_$theme.php";
>} else {
> print("$theme");
> require "content/header.php";
>}
>
>now one would think that if it didn't return true that the else
>statement wouldn't print anything for $theme ... but it does. Also if I
I would expect it to error (undefined variable theme). We need to know
what's being printed.
(BTW, to avoid the risk of calling an undefined variable, I tend to do
something like this at the top of the script:
if (!isset($theme)) {
$theme = "";
}
and this later on:
reguire ("content/header$theme.php");