|
|
| Crunchabird 2004-06-11, 11:14 pm |
| I'm a DW newbie and I'm running the PHP tutorial. I keep getting a parse error
- unexpected T string - when I try the Live Data view with comments-add.php and
comments-view.php. It's the same code string in both instances:
<?xml version="1.0" encoding="iso-8859-1"?>
It's line 24 in comments-view.php and line 51 in comments-add.php.
Anybody out there know what's with this?
Thanks in advance.
| |
| Michael Fesser 2004-06-11, 11:14 pm |
| .oO(Crunchabird)
>I'm a DW newbie and I'm running the PHP tutorial. I keep getting a parse error
>- unexpected T string - when I try the Live Data view with comments-add.php and
>comments-view.php. It's the same code string in both instances:
> <?xml version="1.0" encoding="iso-8859-1"?>
The problem is caused by enabled short_open_tag which allows to enclose
PHP-code with just <? ... ?> instead of the correct <?php ... ?> (you
gave a nice example why one should avoid short tags). In the example
above this leads to a parse error.
Two possible ways out:
* Disable short_open_tag in your php.ini and make sure it's also
disabled on your host's server.
* Print out the string using PHP:
<?php print '<?xml version="1.0" encoding="iso-8859-1"?>';?>
HTH
Micha
| |
| David B 2004-06-11, 11:14 pm |
| Crunchabird wrote:
> I'm a DW newbie and I'm running the PHP tutorial. I keep getting a parse error
> - unexpected T string - when I try the Live Data view with comments-add.php and
> comments-view.php. It's the same code string in both instances:
> <?xml version="1.0" encoding="iso-8859-1"?>
> It's line 24 in comments-view.php and line 51 in comments-add.php.
>
> Anybody out there know what's with this?
> Thanks in advance.
Those parse errors drive me up a wall. I can seldom figure them out.
One tip - download a free trial version of ZendStudio. You can paste
your source code into it, then check it, and it will point out all the
errors. Sometimes, it also suggests a fix. In your case, I suggest it
will only confirm what you already know - that you have an unexpected T
string (as if you ever EXPECTED a T string). But it might possible be of
some help.
| |
| Gary White 2004-06-12, 4:14 am |
| "Michael Fesser" <netizen@gmx.net> wrote in message
news:tmmkc09io15kqsdvo5t5e4qede6mjlhvub@4ax.com...
>
> <?php print '<?xml version="1.0" encoding="iso-8859-1"?>';?>
Third possibility. Delete the unnecessary line, which offers the additional
benefit of leaving IE in standards mode instead of throwing it into quirks
mode. ;-)
Gary
| |
| Crunchabird 2004-06-14, 7:14 pm |
| After I read all your replies, I started looking at the tags and wondered why
the start tag looked like a PHP tag, but didn't say 'php', so I tried adding
'php' to the start tag. No good. So I changed the tags to HTML -like tags and
that worked. The code that worked is: <xml version="1.0"
encoding="iso-8859-1"/>. I don't have a clue why, but I'll take the positive
results. Thanks all for helping to get me going in the right direction.
Bird
| |
| Gary White 2004-06-14, 7:14 pm |
| On Mon, 14 Jun 2004 17:36:56 +0000 (UTC), "Crunchabird"
<webforumsuser@macromedia.com> wrote:
>After I read all your replies, I started looking at the tags and wondered why
>the start tag looked like a PHP tag, but didn't say 'php', so I tried adding
>'php' to the start tag. No good. So I changed the tags to HTML -like tags and
>that worked. The code that worked is: <xml version="1.0"
>encoding="iso-8859-1"/>. I don't have a clue why, but I'll take the positive
>results. Thanks all for helping to get me going in the right direction.
It's called an XML prolog and your change simply makes the it useless.
As I said, you would be better off removing it completely. It's NOT a
PHP tag. It is not a required page element and putting ANYTHING before
the DOCTYPE will cause IE to render the page in quirks mode which can
lead to other undesirable effects.
Gary
| |
| Michael Fesser 2004-06-14, 7:15 pm |
| .oO(Crunchabird)
>After I read all your replies, I started looking at the tags and wondered why
>the start tag looked like a PHP tag, but didn't say 'php',
It's not a PHP-tag and has nothing to do with PHP, it's called a
processing instruction to tell clients how to handle/interpret the
following content:
<?php ... ?>
<?xml ... ?>
<?pike ... ?>
<?whatever ... ?>
>so I tried adding
>'php' to the start tag. No good. So I changed the tags to HTML -like tags and
>that worked.
It doesn't.
>The code that worked is: <xml version="1.0"
>encoding="iso-8859-1"/>.
This is useless and invalid. You were given three possible (and
working!) ways to solve your problem.
Micha
|
|
|
|
| Copyright 2003 - 2009 forum4designers.com Software forum Computer Hardware reviews |