Collection/seek

From PunchCMS
Revision as of 23:07, 25 December 2008 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.
}