Difference between revisions of "Collection/seek"

From PunchCMS
Jump to: navigation, search
(New page: __NOTOC__ ==== Collection->seek(position) ==== === Overview === Seek the internal pointer to a specific position in the collection. === Arguments === '''position''' [integer]<br> The posi...)
 
(No difference)

Latest revision as of 23:07, 25 December 2008

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