View previous topic :: View next topic |
Author |
Message |
BRDude Smarty Rookie
Joined: 23 Nov 2003 Posts: 17
|
Posted: Wed Nov 26, 2003 2:06 pm Post subject: Triple quotes in comments |
|
|
No big deal, easy workaround, but worth mentioning IMHO. The following config file doesn't work:
Code: |
# Please use triple quotes (""") for multi-line values
whatever = """This is a
multi-line
value."""
|
{#whatever#} (and any other entry within triple quotes) won't be defined simply because there's a triple quote inside a comment line. |
|
Back to top |
|
BRDude Smarty Rookie
Joined: 23 Nov 2003 Posts: 17
|
Posted: Thu Jan 01, 2004 3:19 pm Post subject: |
|
|
This bug report seems to have been ignored, I'm bumping it up, hope someone replies about it.
The triple quote bug gave me a hard time the other day, triple quotes should be parsed someway else, the way it's done with preg_replace isn't safe for config files IMHO. |
|
Back to top |
|
Budda Smarty Regular
Joined: 19 Apr 2003 Posts: 53 Location: Lymm, Cheshire. UK
|
Posted: Tue Feb 10, 2004 3:27 pm Post subject: |
|
|
I'm having a right problem with triple quotes too, but not caused by exactly the same problem.
Using Smarty 2.6.1 on a linux based server.
Some lines in a config file do not appear to be getting picked up any more. So when referencing them as {#whatever#} in the template - it just comes out blank!
Most annoying as i never noticed that this had started happening randomly on the site.
The fix appears to be putting a line break before the next variable definition in the config file. Then Smarty recognises it.
What's the probability of this getting a lookin' and fix? |
|
Back to top |
|
ubaldo Smarty Regular
Joined: 21 Apr 2003 Posts: 35 Location: Barcelona, Spain
|
Posted: Tue Feb 10, 2004 10:10 pm Post subject: |
|
|
I'm migrating to 2.6.1 today (from 2.5) and must say that triple quote parsing has been a royal pain.
I hit the comment bug plus another more difficult to track. For example, when the """" is placed right before a section, like this
whatever = """This is a
multi-line
value."""
[a_section]
The config parsing gets messed up. A workaround is a space, for example:
whatever = """This is a
multi-line
value."""
[a_section]
But now, I used to have a value set to 'yes' (for a button label). e.g
yesButtonLabel="""Yes"""
This no longer works, it basically sets the value as a boolean as if you were doing
yesButtonLabel=Yes
I'm having the same problem with Literal 'No'. Haven't found a workaround yet. _________________ Ubaldo Huerta
http://madrid.loquo.com
http://rentals.loquo.com |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Feb 10, 2004 10:28 pm Post subject: |
|
|
i had to rewrite the whole parsing of triple-quotes to handle trip-quotes in comments correctly.
this was done before the 2.6.1 release.
it seems i introduced some bugs with that. i'm having a look into it.
regarding the bug that the section (and other things) following a close '""""' is not recognized:
line 313 of Config_File.class.php should read
$var_value .= substr($lines[$i], 0, $pos);
instead of
$var_value .= substr($lines[$i++], 0, $pos); |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Feb 10, 2004 10:42 pm Post subject: |
|
|
regarding the issue with: var = """YES""" becoming (boolean)true is caused by the fact that triple-quoted vars are handled like single-quoted ones now.
to make it become (string)YES you have to set $smarty->config_booleanize=false.
but this is just an ugly workaround for this incompatibility, of course.
i think the best behaviour (though not 100% compatible with 2.5.0) would be:
var="YES" => (string)YES
var=""""YES""" => (string)YES
var = YES => (boolean)true
(when config_booleanize is true. all values are literal "YES" when config_booleanize is false anyway).
not? |
|
Back to top |
|
Budda Smarty Regular
Joined: 19 Apr 2003 Posts: 53 Location: Lymm, Cheshire. UK
|
Posted: Wed Feb 11, 2004 1:47 pm Post subject: |
|
|
Good stuff.
At least I now know i'm not going mad! |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Feb 12, 2004 11:52 am Post subject: |
|
|
Okay, I updated Config_File to not booleanize triple-quotes. It should now behave like before Smarty-2.6.1 . please test. |
|
Back to top |
|
|