I found another issue with patTemplates. When I'm done posting here, I'll check the pat forum to see if it's being addressed.
When you add an array to a template, say you're using a template with your $rows array, it will loop automatically. Now, say you're using a condition and one of your sub conditions is __first. The __first sub condition will only output on the first iteration of your array. But, In patTemplates 3.1.0, there is a new undocumented sub condition called __single. The problem is, if sometimes your $rows array only contains a single value, __first fails. So, you have to add a __single sub template and duplicate everything that's in your __first sub template. It makes things a little messy and adds un-needed redundancy.
I ran across this when I added pageNav to my component. I have a form that only displays on the first iteration of my $rows array. What I discovered was that when a page only contains a single record, the form wasn't displaying. This little bug is going to cause major problems working with pageNav if you need to use the __first sub condition.
As an example, suppose you have added a $rows variable to a template named "rows". Here is an example template:
Code: Select all
<mos:tmpl name="rows">
<mos:Call template="rowstemplate"/>
<mos:tmpl name="formcondition" type=condition conditionvar="rows.rowid">
<mos:sub condition="__first">
<mos:Call template="formtemplate"/>
This fails if there is only one record in $rows
</mos:sub>
<mos:sub condition="__single">
<mos:Call template="formtemplate"/> <--- redundant
This works if there is only one record in $rows
</mos:sub>
</mos:tmpl
</mos:tmpl>
Note how __first fails if there is only one record in $rows and how we had to add __single to make things work.