Each content page is created using a template. There is exactly one template for each page, but the template is not the entire page - instead the template is rendered in the context of a Layout. For a typical website there is usually only one or two layouts, but there will be several templates. Parts of the page which are unchanging from one page to the next belong in the layout. Most commonly the layout has the site's logo, a header, a footer and a space in the middle for the output from the page template. Templates and layouts consist of HTML and may use either HAML or ERB as a templating language to allow dynamic content. The types of dynamic content are described below.
You can also see a definition of the parts of a page.
The power of templates come from the ability to include regions that contain dynamic content, i.e. content which is created at the time the page is created. The system supports various types of region, some of which can be edited. The most often used type is a "field". The other broad type is a module which provides a piece of functionality and may take some parameters. Example modules include a map, a picture gallery and a form. Below is a description of each field and how to use it. The examples below use HAML, but they could also be used in an ERB template or layout.
Fields are areas which a user can edit. The simplest field definition is:
= field("field_name")field_name is the name of the field. It must be unique on the page and it must contain only letters, numbers and underscores. Without specifying any other options this field will be a 'text' field - several lines long.
You can specify additional options as follows:
= field("field_name", "type", "Title", true, "div")The type may be either "text" or "line", though both are treated the same in the editor. "Title" is what the user sees as a prompt for that field - if it is not present then the field_name is used having been converted so that "field_name" becomes "Field Name". The true/false value indicates whether this field can contain code which should be evaluated (use with care). Lastly the type of field wrapper is specified here as "div". It is unlikely that you would usefully use anything different.
Several of the following modules refere to an ID. This ID can either be a integer number representing the ID of the module instance (which can be found by browsing to the module concerned in the Dashboard and looking at the URL in the browser) or the module instance name, as a string, e.g. "the_name".
Shows a collection of links, which can be formatted in to various menu styles using a stylesheet.
= kit_menu(ID)
A snippet of content - usually text but may also include formatting or other HTML.
= kit_snippet(ID)
A google map for the location specified. Title, height and width are all optional. Specify height and width as a number of pixels; just the number, no "px".
= kit_map("location", "Title", height, width)
Where "location" is the place on which the map should be centred.
The current 4 digit year.
= kit_current_year
The currently logged-in user's email address. If not logged in this will be blank.
= kit_users_email
The given view (a view is typically a colleciton of content from multiple pages)
= kit_view(ID)
= kit_form(ID)
= kit_gallery(ID)
Evaluates the Ruby code. Use with caution.
= kit_code("# Ruby Code")
A page and forum search box.
= kit_search
This module allows you to retrieve a field of content from any page (not just the page on which this module appears). The given field from the given page (page_id can be the page's ID number of the page's URL). The true/false indicates if the field may contain a template - the default is false.
= kit_page_field(page_id, "field_name", false)
For more advanced requirements you can use Blocks. These are pre-defined page elements which can be used in various places in various ways. They can have parameters to allow them to display something different in each circumstance.