SSViewer_BasicIteratorSupport
class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider
Defines an extra set of basic methods that can be used in templates that are not defined on sub-classes of {@link ViewableData}.
Methods
No description
Set the current iterator properties - where we are on the iterator.
Returns true if this object is the first in a set.
Returns true if this object is the last in a set.
Returns 'first' or 'last' if this is the first or last object in the set.
Return true if this object is between the first & last objects.
Return 'middle' if this object is between the first & last objects.
Return true if this object is an even item in the set.
Return true if this is an odd item in the set.
Return 'even' or 'odd' if this object is in an even or odd position in the set respectively.
Return the numerical position of this object in the container set. The count starts at $startIndex.
Return the position of this item from the last item in the list. The position of the final item is $endIndex, which defaults to 1.
Return the total number of "sibling" items in the dataset.
Returns the modulus of the numerical position of the item in the data set.
Returns true or false depending on if the pos of the iterator is a multiple of a specific number.
Details
at line 24
static array
get_template_iterator_variables()
at line 49
iteratorProperties(int $pos, int $totalItems)
Set the current iterator properties - where we are on the iterator.
at line 60
bool
First()
Returns true if this object is the first in a set.
at line 70
bool
Last()
Returns true if this object is the last in a set.
at line 80
string|null
FirstLast()
Returns 'first' or 'last' if this is the first or last object in the set.
at line 99
bool
Middle()
Return true if this object is between the first & last objects.
at line 109
string
MiddleString()
Return 'middle' if this object is between the first & last objects.
at line 124
bool
Even(int $startIndex = 1)
Return true if this object is an even item in the set.
The count starts from $startIndex, which defaults to 1.
at line 135
bool
Odd(int $startIndex = 1)
Return true if this is an odd item in the set.
at line 146
string
EvenOdd(int $startIndex = 1)
Return 'even' or 'odd' if this object is in an even or odd position in the set respectively.
at line 158
int
Pos(int $startIndex = 1)
Return the numerical position of this object in the container set. The count starts at $startIndex.
The default is the give the position using a 1-based index.
at line 170
int
FromEnd(int $endIndex = 1)
Return the position of this item from the last item in the list. The position of the final item is $endIndex, which defaults to 1.
at line 180
int
TotalItems()
Return the total number of "sibling" items in the dataset.
at line 193
int
Modulus(int $mod, int $startIndex = 1)
Returns the modulus of the numerical position of the item in the data set.
The count starts from $startIndex, which defaults to 1.
at line 207
bool
MultipleOf(int $factor, int $offset = 1)
Returns true or false depending on if the pos of the iterator is a multiple of a specific number.
So, <% if MultipleOf(3) %> would return true on indexes: 3,6,9,12,15, etc. The count starts from $offset, which defaults to 1.