Re: What does <?xml have to do with it?

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

 



On Sun, 2008-12-28 at 11:40 -0500, 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
> 
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
Sounds like you have short tags turned on in your php.ini. Search the
php.ini file for short tags (possibly short_tags) and make sure it is
set to off. Note however, that if you have an older app, it may require
these types of PHP tags to function. In that case, you could use an echo
(or print) as the last line of PHP and output the line of XML you need
instead of putting it as standard output after the ?> closing tag for
the PHP.


Ash
www.ashleysheridan.co.uk


-- 
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