[Petal] [rfc] if: ... then: ... else: ... modifier

Steve Purkis spurkis at mkdoc.com
Thu Sep 11 15:53:28 BST 2003


On Thursday, September 11, 2003, at 12:28  pm, Jean-Michel Hiver wrote:

>> <a
>>   petal:attributes="class if: search_page then: string: nav-selected 
>> else: string: nav-unselected"
>>   href="/search.html" class="nav">Search</a>
>
> Why not :)
>
> Note that you could do the same as above as follows:
>
> <a petal:condition="true:search_page"
>    href="/search.html"
>    class="nav-selected">Search</a>
>
> <a petal:condition="false:search_page"
>    href="/search.html"
>    class="nav-unselected">Search</a>

That's what I had originally, except the html is a lot longer that this 
example.  And then times it by 10, and you find you have to do *loads* 
more work.

Code duplication is a bad thing.

-Steve



More information about the Petal mailing list