Closed lhasselb closed 8 years ago
It's because the $WidgetHolder creates a new context, one where the current iterator is NOT available.
You need to add the iterator-specific variables into the top level template.
<% loop WidgetControllers %>
<div class="<% if FirstLast %> $FirstLast<% end_if %>">
$WidgetHolder
</div>
<% end_loop %>
If I am not wrong the WidgetHolder.ss template is used within the WidgetArea.ss template to wrap the Widgets added to a page: Here is the WidgetArea.ss
and the WidgetHolder.ss:
But if I add $Pos or $TotalItems to the latter the value for both position indicators is always 1 (for all Widgets added - I added 3). This came to my attention because the line
<% if FirstLast %> $FirstLast<% end_if %>
added "first last" every time (in my case for all 3 Widgets).
The documentation points out $FirstLast: Returns a string, "first", "last", "first last" (if both), or "". Useful for CSS classes.
If it is intended like that how should the logic for
<% if FirstLast %> $FirstLast<% end_if %>
work?