Chris Parrish said the following on 11/09/2007 11:42 AM:
> Andrew Neil wrote:
>> Currently, there is no tag equivalent to <r:has_child>, as far as I  
>> know. There are tags <r:parent /> and <r:unless_parent />. If such a  
>> tag was to be created, it would probably be useful to create its  
>> opposite as well, e.g <r:has_no_child> or <r:childless>. (Any  
>> thoughts as to how the pair of tags should be named?)
>>   
> A while back I mocked up an extension that abstracted conditionals.  I 
> like having a test for children as Andrew suggests but does anyone else 
> think it would be useful to have a general <r:if> radius tag so that 
> things like this could be added without cluttering up the number and 
> variety of default if_tags out there?
> 
> So instead of:
>   <r:if_parent>
>   <r:if_content>
>   <r:if_children>
>   <r:if_next_great_idea>
> 
> you'd have something like:
>   <r:if cond="parent"> or, maybe <r:if cond="page.parent exists?">
>   <r:if cond="parts">
>   <r:if cond="children">
> 
> It's not my suggested syntax that I'm so concerned about here as the 
> concept of keeping all the <r:if_stuff> code DRY and reducing the number 
> and complexity of all the different tags for the user.  I'm guessing 
> that this won't be the last conditional radiant adds.


Having a
         <r:if .... >
makes a lot of sense, not just from the POV of DRY, but as a good user
interface.  You only have to learn one way of doing things.

However it needs to be implement COMPLETELY, that is it needs to be able to
support the full range of conditionals and booleans.

At the risk of seeming heretical, the Wiki project 'TWiki' has this feature
'done right', although its context is somewhat different.  However the

    <r:if (cond=  and cond= ) or cond= >

type syntax would be great!

And why shouldn't the conditional inspect the environment, for example, to
determine if this is a http or https connection?

The idea of having a ruby expression in the conditional that returns true or
false would make it very powerful at the cost of introducing a security hazzard.

Oh and don't forget the "else" !


http://twiki.org/cgi-bin/view/TWiki/IfStatements

/anton
_______________________________________________
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