Re: [SMARTY] <? tag problem : Smarty bug?
| From: | philippe dot morange at ca-indosuez dot com | Date: | Wed, 29 Jan 2003 08:56:44 +0000 |
| Subject: | Re: [SMARTY] <? tag problem : Smarty bug? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-7387@lists.php.net to get a copy of this message | ||
Hi,
I know PHP can use short open tags like <? instead of <?php, but I think Smarty should put my
xml
tag in an echo statement...
In one case, when compiles the template, it puts the template line in an echo statement: it works.
In another case, it puts part of the line in an echo statement, but not the part with the xml tag,
and therefore PHP thinks it is an opening tag.
First case, I don't have any Smarty variable inside my xml tags in my template: (It works)
.tpl: <?xml ?>
.tpl.php: <?php echo '<?xml ?>' ?>
Second case, I use a Smarty variable inside my xml tags in my template: (Parse Error)
.tpl: <?xml {$test} ?>
.tpl.php: <?xml <?php echo $this->_tpl_vars['test']; ?> ?>
** It should compile like this: <?php echo '<?xml
'.$this->_tpl_vars['test'].' ?>'; ?> **
If I use the .htaccess file as you said, the opening tag problem will be solved, but not the closing
tag problem.
"Jan Rosier" <rosier@interstroom.nl> le 28/01/2003 18:55:43
Pour : <smarty-general@lists.php.net>, Philippe MORANGE/EST/DOSI/BANQUE_INDOSUEZ/FR@BANQUE
INDOSUEZ
cc : (ccc : Philippe MORANGE/EST/DOSI/BANQUE_INDOSUEZ/FR)
Objet : Re: [SMARTY] <? tag problem : Smarty bug?
Hello,
This isn't an Smarty problem. It's actually expected behaviar. PHP default
settings allows you to use an short open tag <? instead of <?php. If you put
the following line in an .htaccess file in your webroot PHP will only use
<?php as an open tag.
php_flag short_open_tag off
Hope this helps
Jan Rosier.
----- Original Message -----
From: <philippe.morange@ca-indosuez.com>
To: <smarty-general@lists.php.net>
Sent: Tuesday, January 28, 2003 11:56 AM
Subject: [SMARTY] <? tag problem : Smarty bug?
> Hi,
> I think I may have discovered a bug, but maybe it's just that I'm doing
things the wrong way.
>
> 1. When I have in my template: <?xml version="1.0"
> encoding="ISO-8859-1"?>
it works.
> 2. But when I have: <?xml version="1.0" encoding="{$myVar}"?> I get a
parse error.
>
> I checked in the compiled code, and it appears that when I don't have any
Smarty variable between my xml tags, it will simply echo the line:
> 1. <?php echo '<?xml version="1.0"
> encoding="ISO-8859-1"?>'; ?>
> If I have ANY Smarty variable on the line, I'll get:
> 2. <?xml version="1.0" encoding="<?php echo
> $this->_tpl_vars['myVar'];
?>"?>
> PHP will see the <?xml as a PHP tag, thus giving me a parse error...
>
> I had to write this in my template to make it work:
> {literal}<?xml{/literal} version="1.0" encoding="{$myVar}"?>
> giving me:
> <?php echo '<?xml'; ?> version="1.0" encoding="<?php echo
$this->_tpl_vars['myVar']; ?>"?>
>
>
> What do you think?
> Bug?
>
> ==========================================================
> Ce message et ses pièces jointes (le "message") est destiné à l'usage
exclusif de son destinataire.
> Si vous recevez ce message par erreur, merci d'en aviser immédiatement
l'expéditeur et de le
> détruire ensuite. Le présent message pouvant être altéré à notre insu,
Crédit Agricole Indosuez
> ne peut pas être engagé par son contenu. Tous droits réservés..
>
> This message and/or any attachments (the "message") is intended for the
sole use of its adressee.
> If you are not the adressee, please immediately notify the sender and then
destroy the message. As
> this message and/or any attachments may have been altered without our
knowledge, its content is
> not legally binding on Crédit Agricole Indosuez. All rights reserved.
> ==========================================================
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php