v1.2.2 - Official User Guide

Record Objects

Record objects are extracted using the Records (Contents) model. Please refer to the documentation to read more about extractions.

A Record is composed by some standard attributes such as its unique id and many protected data that can be retrieved using the get function:

//Contains the record id

//Contains the record content type id

//You can then retrieve the content type definition of the record using the Content Class type() method:
$type_def = $this->content->type( $record->_tipo );

//Other values (physical of xml) can be retrieved using the get function:
$title = $record->get('title');

Below you can find a sample implementation of the Records (Contents) model and record objects:

$posts = find('Blog')->limit(10)->get();

if (count($posts))
    foreach ($posts as $post)
            echo $post->get('date_publish') . ': ' . $post->get('title') . "\r\n";

To learn how to create or edit Records objects, read Create Record objects.

Linked documents

If you need to manually extract the documents linked to a record, you can use its set_document() function:


//Then, you can access the documents using the key defined into the xml scheme, such as this:
$files = $record->get('files');
$images = $record->get('images');

Note: if you are extracting many records, use the documents method of the Records (Contents) model for better query performances:

$posts = find('Blog')->documents(TRUE)->limit(10)->get();

if (count($posts))
    foreach ($posts as $post)
            print_r( $post->get('files') );

Record categories

To get an array of the record categories, use the categories() method as follows:

$categories_array = $post->categories();

Extract the documents

To extract the documents linked to a record, use the set_documents() method:


$images = $post->get('images');

How to create records

You can easily create, edit, publish, depublish and delete Record objects reading the following tutorial:

Back to Framework

Bancha - Copyright 2011-2012(C) Squallstar Studio -