Collection/seek

From PunchCMS
Jump to: navigation, search

Collection->seek(position)

Overview

Seek the internal pointer to a specific position in the collection.

Arguments

position [integer]
The position of the internal pointer. The first position is 1.

Returns

Nothing

Example

$objCms = PCMS_Client::getInstance();
 
// Seek to the 3rd item in the collection and start looping.
$objElements = $objCms->getElementsByTemplate("Page");
$objElements->seek(3);
 
foreach ($objElements as $objElement) {
    // Loop trough the collection starting at position 3.
}