Models
Models represent the types of data that your site will be based on. You can think of a Model like a car. All cars have attributes that can be added, customized and changed, such as color, size, windows, brakes, interior, etc. A Model is the same; you can add any attributes (here known as fields) and then customize them to suit your needs.
If you are building a photography site, there may be Models called “Photograph” and “Gallery”. If you are building a blog, maybe you will create models called “Blog,” “Post,” and “Comment.” Once a Model is created and the attributes customized, that Model type can be used throughout the site.
A Model is a collection of attributes, or fields, each of which represents a specific type of data, such as text, date, location, image, list, document, and more. If there is a type of value to store in a computer, there is some corresponding field type to represent it. Since a Model is a collection of fields, you are free to structure these however you choose, adding, editing, removing and sorting them at will. Once your Models are created, you can create relationships between them through Associations. Associations come in several types as well; learn more about Associations here.
The way Models are related to each other governs the ways in which you will be able to access the data when creating the front end. It is common, for example, to have a grouping type, such as a Gallery, be associated to many objects of a sub-type, in this case, Photograph. By choosing which Photographs are associated to which Gallery, only the chosen Photographs are seen on each Gallery page. Because of the generality of Interface’s design, Models can be associated in an endless variety of ways, capturing exactly the data and relationships unique to your site.
Models, together with fields and Associations, generate the basis of your site. Every time a Model is created, several things happen:
- The corresponding Content type becomes available in the menu so that you can immediately begin creating content of your new Model type.
- An API URL is added that allows you to pull, create, or update content with any of the supported formats (xml, json, etc.) through HTTP requests.
- Methods become available in the Templates that allow you to retrieve any given set of Content of the given Model based on its properties and relationships to other Content.
All in all, Models are the key to Interface. There are a lot of considerations that go into building a useful and appropriate set of Models and relationships between them, but because Interface is so flexible none of these choices are necessarily permanent. You are free to morph the structure of the site as you are developing it, allowing for a more agile and flexible approach to development and design.
See the Models section of the User Manual for more details and instructions on Interface Models.