class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider (View source)

Defines an extra set of basic methods that can be used in templates that are not defined on sub-classes of ViewableData.

Properties

protected int $iteratorPos
protected int $iteratorTotalItems

Methods

public static 
array
public
iteratorProperties(int $pos, int $totalItems)

Set the current iterator properties - where we are on the iterator.

public
bool
IsFirst()

Returns true if this object is the first in a set.

public
bool
First() deprecated

No description

public
bool
IsLast()

Returns true if this object is the last in a set.

public
bool
Last() deprecated

No description

public
string|null
FirstLast()

Returns 'first' or 'last' if this is the first or last object in the set.

public
bool
Middle()

Return true if this object is between the first & last objects.

public
string
MiddleString()

Return 'middle' if this object is between the first & last objects.

public
bool
Even(int $startIndex = 1)

Return true if this object is an even item in the set.

public
bool
Odd(int $startIndex = 1)

Return true if this is an odd item in the set.

public
string
EvenOdd(int $startIndex = 1)

Return 'even' or 'odd' if this object is in an even or odd position in the set respectively.

public
int
Pos(int $startIndex = 1)

Return the numerical position of this object in the container set. The count starts at $startIndex.

public
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.

public
int
TotalItems()

Return the total number of "sibling" items in the dataset.

public
int
Modulus(int $mod, int $startIndex = 1)

Returns the modulus of the numerical position of the item in the data set.

public
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.

Details

static array get_template_iterator_variables()

No description

Return Value

array

Returns an array of items. Each key => value pair is one of three forms:

  • template name (no key)
  • template name => method name
  • template name => array(), where the array can contain these key => value pairs
    • "method" => method name
    • "casting" => casting class to use (i.e., Varchar, HTMLFragment, etc)

iteratorProperties(int $pos, int $totalItems)

Set the current iterator properties - where we are on the iterator.

Parameters

int $pos

position in iterator

int $totalItems

total number of items

bool IsFirst()

Returns true if this object is the first in a set.

Return Value

bool

bool First() deprecated

deprecated 4.12.0 Use IsFirst() instead

No description

Return Value

bool

bool IsLast()

Returns true if this object is the last in a set.

Return Value

bool

bool Last() deprecated

deprecated 4.12.0 Use IsLast() instead

No description

Return Value

bool

string|null FirstLast()

Returns 'first' or 'last' if this is the first or last object in the set.

Return Value

string|null

bool Middle()

Return true if this object is between the first & last objects.

Return Value

bool

string MiddleString()

Return 'middle' if this object is between the first & last objects.

Return Value

string

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.

Parameters

int $startIndex

Number to start count from.

Return Value

bool

bool Odd(int $startIndex = 1)

Return true if this is an odd item in the set.

Parameters

int $startIndex

Number to start count from.

Return Value

bool

string EvenOdd(int $startIndex = 1)

Return 'even' or 'odd' if this object is in an even or odd position in the set respectively.

Parameters

int $startIndex

Number to start count from.

Return Value

string

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.

Parameters

int $startIndex

Number to start count from.

Return Value

int

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.

Parameters

int $endIndex

Value of the last item

Return Value

int

int TotalItems()

Return the total number of "sibling" items in the dataset.

Return Value

int

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.

Parameters

int $mod

The number to perform Mod operation to.

int $startIndex

Number to start count from.

Return Value

int

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.

Parameters

int $factor

The multiple of which to return

int $offset

Number to start count from.

Return Value

bool