File structure

This file contains a list of objects used in the plugin.

$resources = array(
	'picture' => array(
		'model' => 'pictures', // model name of the 'picture' object
		'items' => 'pictures', // plural name for 'picture' object
		'prefix' => 'p', // custom table prefix where pictures are stored (objects within a plugin must not have the same table prefixes, 'f' and 'u' are reserved prefixes
		'table' => 'pictures_data', // table name where pictures are stored
		'column' => 'picture_id', // column in the table that identifies pictures
		'user' => 'user_id', // user ID column in the table, if applicable
		'orderby' => 'order_id', // default column to sort results by
		'orderdir' => 'asc', // sorting order
		'report' => 1 // enable reporting feature so users could report pictures
	'picture_album' => array(
		'model' => 'pictures_albums', // model name of the 'album' object
		'items' => 'albums', // plural name for 'album' object
		'prefix' => 'a', // table prefix
		'table' => 'pictures_albums_data', // table name where albums are stored
		'column' => 'album_id',
		'user' => 'user_id',
		'orderby' => 'post_date',
		'orderdir' => 'desc',
		'report' => 1

By using these resources we could refer to them in the software and perform various actions with ease. For example Articles plugin would have an "article" object. Pictures plugin would have a "picture" and "album" objects.

Resources are saved into the "core_resources" table in the database.

Using resources

There are various functions in the system that make use of these resources. For example you may check if user liked the picture or album by using this code:

// 'picture' is the resource keyword as in the example above
$this->likes_model->getLike('picture', $pictureID);

// another example for albums
$this->likes_model->getLike('picture_album', $albumID);