Invenzzia »

IMPORTANT ANNOUNCEMENT

Due to the uncertain status of the Flyspray project, lack of new releases and moving the code repository to Github, we decided to shutdown this issue tracker by the end of January 2011. From that date, the bugs should be reported directly in Github project repositories.

List of repositories:

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!
Tasklist

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-8
Last edited by Zyx (Zyx) - Monday, 01 November 2010, 11:20 GMT-8
Task Type Feature Request
Category Template syntax
Status Closed
Assigned To Zyx (Zyx)
Operating System OS-independent
Severity Low
Priority Normal
Reported Version 2.0.1
Due in Version 2.1.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Is:
~~~
<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

Closed by  Zyx (Zyx)
Monday, 01 November 2010, 11:20 GMT-8
Reason for closing:  Won't implement
Additional comments about closing:  Will not be implemented in the current version.
Comment by Zyx (Zyx) - Sunday, 13 September 2009, 00:53 GMT-8
This is already implemented, but as a function:

~~~~
<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.

Loading...