|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Curly braces inside a function argumentHow can put curly braces inside of a function argument? Is it not
possible? everything I've tried doesn't seem to work: {myfunc test="foo {bar}"} {myfunc test='foo {bar}'} {myfunc test="foo {ldelim}bar{rdelim}"} No matter what, smarty always percieves the first closing brace as the closing brace for the function itself. Should this be considered a bug? |
|
|
Re: Curly braces inside a function argumentOn Tue, 21 Aug 2007 12:58:31 -0500
"Ben Davis" <bendavis78@...> wrote: > How can put curly braces inside of a function argument? Is it not > possible? everything I've tried doesn't seem to work: > > {myfunc test="foo {bar}"} > {myfunc test='foo {bar}'} > {myfunc test="foo {ldelim}bar{rdelim}"} > > No matter what, smarty always percieves the first closing brace as > the closing brace for the function itself. Should this be > considered a bug? Not sure if it's the "best" way but did you try: {myfunc test="foo {ldelim}bar{rdelim}"} http://smarty.php.net/manual/en/language.function.ldelim.php Josh -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: Curly braces inside a function argumentHow about using the html entities:
} { Or URL encoding: %7B %7D Then simply decode in your function. This is not a bug.. if you *really* had to you could change your smarty template delimiters and the problem would go away. Josh Trutwin wrote: > On Tue, 21 Aug 2007 12:58:31 -0500 > "Ben Davis" <bendavis78@...> wrote: > > >> How can put curly braces inside of a function argument? Is it not >> possible? everything I've tried doesn't seem to work: >> >> {myfunc test="foo {bar}"} >> {myfunc test='foo {bar}'} >> {myfunc test="foo {ldelim}bar{rdelim}"} >> >> No matter what, smarty always percieves the first closing brace as >> the closing brace for the function itself. Should this be >> considered a bug? >> > > Not sure if it's the "best" way but did you try: > > {myfunc test="foo {ldelim}bar{rdelim}"} > > http://smarty.php.net/manual/en/language.function.ldelim.php > > Josh > > -- Looking for a Creative Support Team? We Can Help... Web, Design and Hosting. Owen Cole Director of Information Technology Blue Spider Inc. PO Box 2219 Warminster, PA 18974 www.bluespiderinc.com Phone : 215-957-1186 Fax : 215-957-5226 -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: Curly braces inside a function argument--- Ben Davis <bendavis78@...> wrote:
> How can put curly braces inside of a function argument? Is it not > possible? everything I've tried doesn't seem to work: > > {myfunc test="foo {bar}"} > {myfunc test='foo {bar}'} > {myfunc test="foo {ldelim}bar{rdelim}"} > > No matter what, smarty always percieves the first closing brace as the > closing brace for the function itself. Should this be considered a bug? Hi. It is a limitation of the parser. There are two ways that I can think of off the top of my head to do this, but I suggest the latter: 1) use an assigning {capture} block to embed an {ldelim}/{rdelim} into a static text block; 2) use the $smarty.ldelim and $smarty.rdelim can be used. Just remember the syntax for embedding vars in quotes: http://smarty.php.net/manual/en/language.syntax.quotes.php eg: {myfunc test="foo `$smarty.ldelim`bar`$smarty.rdelim`"} hope that helps ____________________________________________________________________________________ Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545433 -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: Curly braces inside a function argumentBen Davis wrote:
> How can put curly braces inside of a function argument? Is it not > possible? everything I've tried doesn't seem to work: > > {myfunc test="foo {bar}"} > {myfunc test='foo {bar}'} > {myfunc test="foo {ldelim}bar{rdelim}"} > > No matter what, smarty always percieves the first closing brace as the > closing brace for the function itself. Should this be considered a bug it isn't a bug when I have to generate javascript and/or css I use: class AxSmarty extends Smarty { function __construct() { $this->left_delimiter = '[['; $this->right_delimiter = ']]'; } }; then simply [[myfunc test="foo {bar}"]] Grego -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
| Free Forum Powered by Nabble | Forum Help |