Re: What does <?xml have to do with it?
| From: | Jim Lucas | Date: | Sun, 28 Dec 2008 16:47:23 +0000 |
| Subject: | Re: What does <?xml have to do with it? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285145@lists.php.net to get a copy of this message | ||
tedd wrote:
> Hi gang:
>
> I have a small php routine to provide the user with a style choice. The
> working url is here:
>
> http://php1.net/a1/david/
>
> The simple code that allows style switching follows:
>
> <?php session_start();
> $the_style = isset($_SESSION['the_style']) ? $_SESSION['the_style'] :
> 'style1';
>
> if(isset($_GET['set']))
> {
> $set = $_GET['set'];
> if($set == 'style1')
> {
> $the_style = 'style1.css';
> }
> else
> {
> $the_style = 'style2.css';
> }
> $_SESSION['the_style'] = $the_style;
> }
>
> $the_style = $_SESSION['the_style'];
> ?>
>
> As you can see, the code works. However, if I add the following line IN
> THE HTML (i.e., after ?>):
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> I receive a:
>
> Parse error: syntax error, unexpected T_STRING
>
> What's up with that? Apparently the php interpreter is considering
> "<?xml" tag as a php declaration -- how do I turn that off? Or is this
> something else?
>
> Cheers,
>
> tedd
>
short tags are enabled. Disable them in your php.ini file and you will be good.
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare