3217 Posts in 853 Topics by 812 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1326 Views |
-
Template Parameter Parsing Problem

28 February 2009 at 12:10am
Hey guys,
If I try and put the following dynamic variable in my template I get an error:
$Top.ResortGroupForm($ID)
This is what the cached file is trying to do for this section and obviously the SSVIEWER is getting confused due to there being no differentiation with the ID and the ResortGroupForm objects
SSVIEWER;
$val .= $item->obj("Top")->XML_val("ResortGroupForm",array("
SSVIEWER;
$val .= $item->XML_val("ID",null,true) ;
$val .= <<<SSVIEWER
"),true) ;
$val .= <<<SSVIEWER--------------------------------------------------------------------------------------------------
However, if I try a static value there is no problem:
$Top.ResortGroupForm(one)
The cached template looks like the following:
SSVIEWER;
$val .= $item->obj("Top")->XML_val("ResortGroupForm",array("one"),true) ;
$val .= <<<SSVIEWERIf anyone has a solution please provide it to me as it would be greatly appreciated.
Thanks
-
Re: Template Parameter Parsing Problem

28 February 2009 at 12:12am
I would presume that if the SSVIEWER for the argument was something like SSVIEWER_ARG then that would solve the issue
-
Re: Template Parameter Parsing Problem

4 March 2009 at 3:22am
Hi Terminator4,
At present, the template system doesn't support variables inside of template method calls (see http://doc.silverstripe.org/doku.php?id=templates#template_syntax). So, you can't do '$Property($OtherProperty)'.
As a workaround to this, you could add a method to your model that returns the equivalent of '$Property($OtherProperty)'. You could then call that new method from your template.
Hope this helps,
Ben
| 1326 Views | ||
|
Page:
1
|
Go to Top |

