Open Power Template 2.x family
PLEASE PROVIDE THE TEMPLATES AND/OR PHP CODE IN THE TASK DESCRIPTION (Not URL-s to them). THAT ALLOWS US TO REPRODUCE THE PROBLEM! OTHERWISE WE ARE NOT ABLE TO HELP YOU!
Remember to hide all the security-related pieces of code from the task description, like passwords, server paths etc. for your own safety. Once we close the task, we cannot edit it anymore!
PLEASE PROVIDE THE TEMPLATES AND/OR PHP CODE IN THE TASK DESCRIPTION (Not URL-s to them). THAT ALLOWS US TO REPRODUCE THE PROBLEM! OTHERWISE WE ARE NOT ABLE TO HELP YOU!
Remember to hide all the security-related pieces of code from the task description, like passwords, server paths etc. for your own safety. Once we close the task, we cannot edit it anymore!
FS#118 - Put a variable value or a default value
Attached to Project:
Open Power Template
Opened by Damian Nowak (Nowaker) - Saturday, 12 September 2009, 18:12 GMT-7
Last edited by Zyx (Zyx) - Sunday, 13 September 2009, 01:01 GMT-7
Opened by Damian Nowak (Nowaker) - Saturday, 12 September 2009, 18:12 GMT-7
Last edited by Zyx (Zyx) - Sunday, 13 September 2009, 01:01 GMT-7
|
DetailsIs:
~~~ <opt:if test="$myVar"> {$myVar} <opt:else> default </opt:else> </opt:if> ~~~ Could be: ~~~ <opt:var name="myVar">default</opt:var> ~~~ No default value: ~~~ <opt:var name="myVar" /> (the same as {$myVar}) ~~~ |
This task depends upon
~~~~
<p>{firstof($myVar, 'Default value')}</p>
~~~~
You can use it to select the first non-empty value from the provided attributes. Another way is to use `opt:content` attribute. I'll add a page about it to the wiki, because I agree the "trick" could be confusing. However, I'll keep it open, because the idea of creating the tag version of `opt:content` seems quite nice.