Login | Forgot password | Register
What is OpenID?
OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.
With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.
For more information visit the official OpenID site.
Archive
SilverStripe Forums » Archive » Curly braces in templates
Our old forums are still available as a read-only archive.
|
Page:
1
|
Go to End | |
| Author | Topic: Curly braces in templates | 941 Views |
-
Curly braces in templates

13 August 2007 at 1:55pm Last edited: 13 August 2007 2:00pm
Hi,
i have in my template: {$Date.Format(l Y/m/d)}, and the result is: {$Monday 2007/08/13}
I.e. the curly braces are in the output as well. I have noticed, each non-curly-braced replacement has a curly-braced replacement, except one, in SSViewer.php, so I have added this missing one:--- SSViewer.php.orig 2007-07-31 09:40:06.000000000 +1200
+++ SSViewer.php 2007-08-13 13:48:43.000000000 +1200
@@ -195,6 +195,7 @@
'/{\\$([A-Za-z_][A-Za-z0-9_]*)\\.([A-Za-z0-9_]+)}/' => '<?= {dlr}item->obj("\\1",null,true)->XML_val("\\2",null,true) ?>',
'/{\\$([A-Za-z_][A-Za-z0-9_]*)}/' => '<?= {dlr}item->XML_val("\\1",null,true) ?>\\2',+ '/{\\$([A-Za-z_][A-Za-z0-9_]*)\\.([A-Za-z0-9_]+)\\(([^),]+)\\)}/' => '<?= {dlr}item->obj("\\1")->XML_val("\\2",array("\\3"),true) ?>\\4',
'/\\$([A-Za-z_][A-Za-z0-9_]*)\\.([A-Za-z0-9_]+)\\(([^),]+)\\)([^A-Za-z0-9]|$)/' => '<?= {dlr}item->obj("\\1")->XML_val("\\2",array("\\3"),true) ?>\\4','/\\$([A-Za-z_][A-Za-z0-9_]*)\\(([^),]+), *([^),]+)\\)([^A-Za-z0-9]|$)/' => '<?= {dlr}item->XML_val("\\1",array("\\2","\\3"),true) ?>\\4',
Btw. A comma in the argument: $Date.Format(l, Y/m/d)
causes an error. Is there any way, how to put the comma in the argument?Btw2. Isn't this regexp replacing in the SSViewer a little bit complicated? What about some simple LL/LR parser?
-
Re: Curly braces in templates

14 August 2007 at 11:28am
Yeah, the reg-exp parser just kind of grew out of all proportion; a better parser needs to be made ;-)
| 941 Views | ||
|
Page:
1
|
Go to Top |
Currently Online: Cristian, Achilles Interactive
Welcome to our latest member: J2-Paul


