Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Creating a Layout

Johan Strydom edited this page Feb 15, 2014 · 6 revisions

Layouts allow you to define an initial set of tags that will be used all over the site. Each layout tag can also be used to execute services via the service configuration. Because layouts only define tags the style for the layout should be done via a theme. (E.g. when you want to float certain tags)

Layouts should not contain all the tags you want to see in you website, rather it should contain the most basic tags that make out the frame of the site. The rest of your site tags should be created via the various services that are executed.

Basic Layout

In this example a basic layout with a container div, header, article and footer are created.

XML file

In the /layouts folder, create a file called basic.xml

Layout info

Add the following to the basic.xml file

<?xml version="1.0" encoding="UTF-8"?> <layout name="basic"></layout>

The Layout

Within your layout, add the following

<container><header/><article id="main" primary="true" /><footer /></container>

Tsama will create an equivalent HTML5 node for each tag in the layout. If no id is specified, the node will automatically be created with an id as per the name of the tag. If the tag name is not in the HTML5 standard, a div node will be create in its place E.g.

<container></container>

Will be created as

<div id="container"></div>

Activate the basic layout

To activate the layout, replace $_TSAMA_CONFIG['LAYOUT'] = 'default' with basic in the /conf/site.conf.php file

Layout override

It is possible to override the default configured layout by specifying another layout in the Service configuration file. This can only be done with primary services. See Configuring a Service

E.g.

<service name="basic" primary="true" layout="anotherlayout" >

Table of contents

Introduction

Installation and Configuration

Predefined Constants and Globals

Creating a Layout

Creating a Theme

Creating a Service

Configuring a Service