Table of Contents
Recite CMS allows non-technical users to add dynamic content to their web site easily using the template management tools (refer to the Managing Templates chapter for more details).
Templates are written using Smarty Template Engine syntax. This appendix covers how to
write templates in this format and also shows you some Recite-specific template
functionality. You can find the complete Smarty manual at http://smarty.net/manual/en/
, or you can
refer to the Template Writing Guide
appendix in this guide.
A pre-requisite of writing templates is some knowledge of HyperText Mark-Up Language (HTML). While technically this is not required, templates in Recite CMS are used either for HTML pages or e-mail templates.
All templates have a series of values that you can access which will determine the output of the page (or email) the template is being used for. Each template type in Recite CMS has different values assigned to it, each of which is documented with the template documentation widget that is available within the Control Panel.
For example, the calendar event listing template type will provide you with a list of events to loop over, while a template for a email contact form will include values relating to the form.
Most template types have one or more sample templates associated with them. The easiest way to create templates in Recite CMS is to use one of the sample templates as a starting point then refine it as required.
There are different ways of using these values, each of which involves a special command
surrounded by curly brances (that is, {
and }
). Each
of these ways (outputting a variable, if/else blocks and loops) are all covered in this
appendix.
There are a number of different types of values that can be assigned to a template, each of which is used in different situations. These different types are as follows.
Array. This is an array designed so you can loop over the
elements using {foreach}
or {section}
. You can access
its elements directly if required. Refer to the section on loops later in this
appendix.
Associative Array. This is an array designed so you can
access its elements directly by their key, or you can either loop over with
{foreach}
or {section}
. Refer to the section on
loops later in this appendix.
Boolean. A true/false value. Refer to the if/else blocks section later in this appendix.
Float. A number, possibly with decimal points.
Integer. A number.
Mixed. A mixed value is one of several types. It may be an integer, string, boolean or an array.
String. A string of text. Typically you should use the
escape
modifier when outputting strings.