[Petal] Re: Petal wish list
William McKee
william@knowmad.com
Thu, 25 Jul 2002 08:54:11 -0400
On 25 Jul 2002 at 11:37, Jean-Michel Hiver wrote:
> Well, if I did that I would be crossing the yellow line of separating
> content and code I think. For the example above you could use :not or
> :false modifiers, i.e.
>
> <option value="" petal:if=":false user_id" >Select</option>
Ah, of course! I'm still learning to think in this new templating language. Is it
possible to stack modifiers? For example, would the following be a valid:
<option value="" petal:content=":encode :ucfirst title">Class Title</option>
> Another way of doing it is to give Petal a dummy object which has method
> that do what you want, i.e. you could have an 'operations' object that
> could look like that:
Hmm, very interesting. I'll definitely keep this in mind.
> <p petal:condition="operation.lt $day 15">
> Today is before the 15th
> </p>
> <p petal:condition="operation.ge $day 15">
> Today is the 15th or after the 15th
> </p>
Wow, that's interesting syntax in the condition element. I didn't realize that you can
include parameters that will be passed to the object being evaluated.
While on the subject of conditions, is it possible to have Petal remove the tag the
conditional is in if the condition fails? For example, I have a tag that looks like the
following:
<p class="error" petal:if"error_message" petal:content="error_message">Error
Message</p>
If there is no error, the output will contain:
<p class="error" petal:if"error_message" petal:content="error_message"></p>
I'd prefer to remove the p tag altogether. Perhaps I should place it into a span as
follows:
<span petal:if="error_message"><p class="error"
petal:content="error_message">Error Message</p></span>
I like the simplicity of keeping it all together in the p tag but don't really want it
printing the tag group if the condition fails.
> But I'd go for the custom modifier :-)
Yes, that does sound like it would be the more straight-forward path.
Thanks,
William
--
Lead Developer
Knowmad Services Inc. || Internet Applications & Database Integration
http://www.knowmad.com