|
You are here: Home / Documentation / Creating Custom Content Types (Collections) in Sitellite |
Creating Custom Content Types (Collections) in SitelliteThe Collection Definition FileCollection definition files live in the inc/app/cms/conf/collections folder. They are INI-formatted files with a .php extension, which we'll explore further in a moment. In Sitellite apps, it is standard to keep these files in the app's install folder, with the installation instructions to copy them to the collections folder upon installation. See the apps available on sitellite.org for examples. Definition HeaderA collection definition file always begins with the same three blocks: [Collection], [Source], and [Store]. These blocks describe the general behaviour of the collection, and tell Sitellite which source and store drivers to use to access its data and store new revisions. [Collection]The collection block describes the essentials of your collection to Sitellite. This includes a display name, some of the important field names, etc. The full list of properties in this block are:
Continuing our collection of favourite tunes, the collection block would be: [Collection] name = myapp_tunes display = Tunes singular = Tune key_field = id key_field_name = ID title_field = title title_field_name = Title body_field = lyrics is_versioned = yes [Source]The source block only requires one field, the "name" field. This tells Sitellite the name of the driver to load. Source drivers are in the inc/app/cms/lib/Versioning/Source folder. So, for example, if you wanted to use the "Database" driver (this is the one you want for most uses), then your source block would look like this: [Source] name = Database The reason there may be additional properties is that they are passed to the source driver itself, which may require additional information. For example, the "Filesystem" driver requires a "path" property, which is the path to the root folder to store files in, relative to the root of your web site. [Store]The store block behaves exactly like the source block, except that it loads store drivers instead, from the inc/app/cms/lib/Versioning/Store folder. A store is where the revision history of a document is stored. The most common store drivers are "Database" and "Blank". The database driver stores revisions in the "_sv" database table that we saw above. The blank driver doesn't store revisions at all. The blank driver is used on collections with the "is_versioned" property under the collection block set to "no". An example store block would look like this: [Store] name = Database Page 1: Creating a Rex Collection |
|
Copyright © 2008, SIMIAN systems Inc. All rights reserved. Privacy policy Some of the icons on this site were created by the Gnome Project. |