Templates

About Templates

Templates can be thought of a ‘site starting points’. They consist of site export files (site.xml and media/), an info.xml file, and an optional thumbnail.png image.

Templates are kept in two directories:

  • segue/templates-dist – Templates distributed with Segue
  • segue/templates-local – Your own custom templates

The ID of a template is its directory name, e.g. segue/templates-dist/Basic has an ID Basic.

By default, templates are ordered alphabetically by ID. A custom ordering can be set in segue/config/templates.conf.php:

$templateMgr->setOrder(array(
"StandardCourseSite",
"Basic",
"Blog"
));

Any templates not listed in the order array will be displayed alphabetically after the ordered templates.

Creating Templates

While the template XML can be edited by hand, the easiest way to create a template is to start from an existing site.

  1. Create a site that you will use to build your template.

    Enter #SITE_NAME# and #SITE_DESCRIPTION# for the display-name and description of the site to pre-populate the template-site with appropriate placeholders.

  2. Configure the site to your liking. Any place you use #SITE_NAME# or #SITE_DESCRIPTION# in the text, the placeholder will be replaced with the site name and description that users enter when the create a new site using this template.
  3. Export the site
  4. Un-Tar the exported archive.
  5. Create a new directory (to go in segue/themes-local/) named for the template
  6. Place site.xml and media/ directory (if it exists) into the new template directory
  7. Add an info.xml file to the new template directory with information about your template.
    <TemplateInfo>
    <DisplayName lang='en_US'>Basic</DisplayName>
    <Description lang='en_US'>
    This template is a basic starting point with two pages already created.
    </Description>
    </TemplateInfo>
  8. You can optionally add additional translations of the display name and description.
    <TemplateInfo>
    <DisplayName lang='en_US'>Spanish School Template</DisplayName>
    <Description lang='en_US'>
    This template is laid out for classes taught by the Spanish School and
    Spanish department.
    </Description>
    <DisplayName lang='es_ES'>Plantilla de la Escuela Española</DisplayName>
    <Description lang='es_ES'>
    Esta plantilla se presenta para las clases enseñadas por la escuela
    española y el departamento español.
    </Description>
    </TemplateInfo>
  9. You can optionally add Agent or Group restrictions to the info.xml to make the template only available to certain users.
    <TemplateInfo>
    <DisplayName lang='en_US'>Spanish School Template</DisplayName>
    <Description lang='en_US'>
    This template is laid out for classes taught by the Spanish School and
    Spanish department.
    </Description>
    <DisplayName lang='es_ES'>Plantilla de la Escuela Española</DisplayName>
    <Description lang='es_ES'>
    Esta plantilla se presenta para las clases enseñadas por la escuela
    española y el departamento español.
    </Description>
    <Authorized>
    <Group id="123456">Spanish School</Group>
    <Agent id="789102">Spanish School Coordinater</Agent>
    <Group id="CN=Spanish Dept,OU=Groups,dc=example,dc=edu">Spanish Department Faculty</Group>
    </Authorized>
    </TemplateInfo>

    The ids of the Groups and Agents should match those in your Agent system, but the name is just an aid to provide information in a template listing.

  10. If you haven’t already, put the new template directory in segue/themes-local/

With these steps done, the template should show up in the list of templates when users go into the ‘create site’ wizard.



Comments are closed.