Re: [SMARTY] PHP parsing error on Smarty assign
| From: | Mark Rogers | Date: | Wed, 30 Jun 2004 22:50:11 +0000 |
| Subject: | Re: [SMARTY] PHP parsing error on Smarty assign | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11512@lists.php.net to get a copy of this message | ||
Martin Braun writes:
> this is not exactly a smarty prob, you should really consult the php
> list. but so what:
One problem with asking the wrong people, of-course, is that you're less
likely to get the right answer....
> you can't use heredocs in this context. try just assigning something to
> 'code' and it will work (did here).
I'm not sure you're correct; I think the syntax error is the trailing
semicolon (;).
Consider a simpler example:
<?php
$tmp = array(
'xx' => <<<EOD
hello!
EOD;
);
var_dump($tmp);
Here, this is equivalent (apart from whitespace) to:
$tmp = array(
'xx' => "hello!";
);
var_dump($tmp);
Now the extra semicolon is obvious. Switch "EOD;" to "EOD" and it works
fine.
No offense intended, Martin, as you've clearly tried to be helpful, but
instead you've helped illustrate one reason why asking in the right place
matters!
--
Mark Rogers,
More Solutions Ltd :: Tel: 0845 45 89 555