Todd McGrath wrote:
> In the default radius tags, is there a way to replicate if-then-else flow?  
> 
> Something like:
> <r:if_content part="testy">
> x
> <r:else/>
> y
> </r:if_content>

It would be hard to get Radius to parse this.

> <r:choose>
> <r:when part="testy">
> x
> </r:when>
> <r:otherwise>
> y
> </r:otherwise>
> </r:choose>

That's an interesting idea. Though perhaps it should work more like Ruby:

<r:case>
   <r:when part="foo">
   x
   </r:when>
   <r:when part="bar">
   y
   </r:when>
   <r:else>
   z
   </r:else>
</r:case>

The difficulty is that Radius doesn't provide a way to make true 
conditional statements. That's one of the nice aspects of it being a 
tagging library (it isolates you from the conditionals and forces you to 
put advanced logic in custom tags).

I suppose the when tag could just have a number of attributes that would 
allow you to make predefined comparisons:

   url="..."
   url_starts_with="..."
   url_ends_with="..."
   has_part="..."

But that seems rather convoluted.

Perhaps the case tag could specify an object (doing some sort of 
variable expansion) and the when tag could do comparisons:

<r:case object="${page.title}">
   <r:when equals="foo">
   x
   </r:when>
   <r:when ends_with="bar">
   y
   </r:when>
   <r:else>
   z
   </r:else>
</r:case>

But again, it all seems convoluted.

--
John Long
http://wiseheartdesign.com

_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to