On Jun 7, 2011, at 11:26 AM, Tim Griffin wrote:

> Thanks for your reply Matt, and thanks for the clarification about the 
> "default" param. 
> 
> It appears, however, there is an issue lurking when the tag definition 
> includes conditional logic. Perhaps you can suggest the right approach? 
> 
[snip]
> 
> But, if i introduce <if><else> logic, it suddenly doesn't work again, and 
> gives me the "mixed parameter tags and non-parameter tags" error:
> 
> <def tag="amalgamations-collection" attrs="forprint">
>   <collection>
>     <if test="&forprint">
>       <card: class="amalgamation">
>         <strong><view:name/></strong>
>         <br/><view:date_amalgamated/>
>         <br/>
>         <br/>
>       </card:>
>     </if>
>     <else>
>       <card: class="amalgamation">
>         <h4><name/></h4>
>         <b>Amalgamated on:&nbsp;&nbsp;</b><view:date_amalgamated_formatted/>
>       </card:>
>     </else>   
>     <empty-message:><t 
> key="amalgamation.collection.empty_message"/></empty-message:>
>   </collection>
> </def>
> 
> Why is that? However <if> evaluates, we get a definition to be passed as the 
> <card> parameter. What is confusing Hobo about mixed tags?
> 
> How do we properly introduce conditional logic in this situation? If you can 
> explain, I will gladly draft an example with notes for Owen to include in the 
> guide. 

The evaluation order of tags is weird - note, for instance, that a param (item 
/ card here) can end up getting called many times in different contexts.

In this case, the most straightforward way to handle this would be to pull the 
common <card:> bit outside of the if/else :

<collection:>
  <card class="amalgamation">
    <if test="&forprint">
    ...
   </if>
   <else>
     ...
  </else>
</card:>
</collection:>

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to