CMS Class

CMS class

Usage

array $cms->get( string $section, mixed $conditions=NULL, int $num_results=NULL, string $order=NULL, bool $asc=true, string $prefix=NULL )

This is used for pulling content from the CMS example:

$news_items=$cms->get('news'); // would return an array of news articles.

$news_item=$cms->get('news',1); // would return an assoc array of the news item with ID=1.

This is the same as:

$news_item=$cms->get('news',array('id'=>1));

$cms->set_section(string $section, int $id=NULL )

This sets the current section - this is required before displaying fields or saving data.

$cms->get_field( string $name, string $attribs='' )

This outputs a form field like a text input box or a rich text area.
$attribs are added into the field so that you can add class names and other attributes.

$cms->save()

Takes post data and uses it to save to the currently set section.
If an item is selected it will be updated - otherwise a new item will be created.

$cms->delete_items( string $section, mixed $items )

Deletes a single id or an array of ids from the provided CMS section.