Conditional Tags

0 views
Skip to first unread message

Rahul

unread,
Apr 27, 2009, 4:03:42 AM4/27/09
to rife-users
Is there anything like conditional tags in rife life <c:if>? I was
looking to the block tag.... is that the way to do this in rife?

Coat

unread,
Apr 27, 2009, 5:14:59 PM4/27/09
to rife-users
Typically you handle conditional logic where it belongs, in your code,
and define what the different conditions should look like in HTML
using block tags, for example (kinda contrived), in an Element:

if (order.isDeclined()) {
template.setBlock("status", "declined");
}

And in your template:

<r:v name="status"></r:v>
<r:b name="declined">
<div>This order is declined</div>
</r:b>

Take a look at http://rifers.org/wiki/display/RIFE/GuideTemplates for
a better example and reasoning, and also the source code to some of
the example apps help out as well.

It takes a little bit to get used to if you are coming from templating
systems that include scripting languages, but I like it. If you
really need conditional logic in your templates, there's always
Blockvalue scripting: http://rifers.org/wiki/display/RIFE/Blockvalue+scripting+support
but I've never needed to use that beyond the ROLEUSER specialized
script tag though.

Kent
Reply all
Reply to author
Forward
0 new messages