Collection

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

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Collection Methods

orderBy(property, [order])

Order a list of elements by property name ascending or descending.

seek(position)

Seek the internal pointer to a specific position.

random()

Get a random element from the collection.

randomize()

Shuffle the collection of elements.

count()

Get the element count.

current()

Get the element the internal pointer is on.

next()

Get the next element from the collection.

previous()

Get the previous element from the collection.

key()

Get the position of the internal pointer.

valid()

Check if the current element is a valid object.

rewind()

Place the internal pointer at the beginning of the collection.

reverse()

Reverse the order of the elements in the collection.

end()

Place the internal pointer at the end of the collection.

inCollection(value)

Checks if a value is in the Elements collection. Returns TRUE or FALSE.

setPageItems(count)

Set the number of items per page call.

getPageItems()

Get the number of items per page call.

setCurrentPage([value])

Set the current page to show items for.

getCurrentPage()

Get the current page to show items for.

pageCount()

Get the total number of pages in the collection.

pageStart()

Get the index of the first item for the current page.

pageEnd()

Get the index of the last item for the current page.

nextPage()

Get the page index of the next page.

previousPage()

Get the page index of the previous page.

getPageByChild(child)

Get the page number the child item is in.

seekByChild(child)

Advance the internal pointer to a specific index indicated by a child item and return the index.