Elxis CMS - Open Source

elxis 2008
Feel the power of Open Source!


download elxis 2008.0 Olympus
size: 7.35mb | revision: 1891 | stable

Elxis template tutorial - Introduction

In this guide we will examine Elxis front-end templates (what is a template and why it is used) and we will go through all the basic steps in templates creation. This guide is consisted by a numbers of parts that all together consist a compact Elxis template tutorial. This guide is provided for free and without any guarantee. You are not allowed to use this guide in the whole, or parts of it, in commercial books and e-books. If you wish to re-publish it online you can do so by placing a link to the guide' original page at elxis.org. When finish reading this guide we hope that you will be ready to start creating your first Elxis 2008.x templates!

What is a template?

Elxis CMS is a web application developed in PHP that uses a database for storing data (articles for example). Elxis source code is complex for the majority of the users, but don't worry. There is no need to know how Elxis works internally to build a site with Elxis CMS! This is because in Elxis, the PHP logic (inner processes) is separated from the site layout. So, you can change your site's look and feel without the need to know PHP and without messing up with Elxis source code. In order to achieve this we have assigned the site's layout to special extensions called templates. A template is a set of files that defines the site's appearence. They can be installed and unistalled as all the other elxis extensions and you can have multiple templates assigned on one site.

Template files

An elxis template is consisted, at least, by the following files:

  • index.php
  • templateDetails.xml
  • template_thumbnail.png
  • css/template_css.css
  • css/index.html
  • images/index.html

index.php This is the main template file. It is like a normal HTML page with its own layout and CSS. The difference from a usual html page is that inside that page you render Elxis content. So instead of writing your articles directly in this html page you tell elxis to load them from the database just by placing the line bellow in the exact area of your template you want elxis content to be displayed:

<?php mosMainBody(); ?> 

Except from the main elxis content you can load modules. This can be done in 2 ways:

mosLoadModules('left', -2);
//or
elxLoadModule('mod_banners', -1);

If you are not familiar with the code above, don't worry. We will explain everything later.

templateDetails.xml The template''s XML installation file. All elxis extensions have an XML installation file that give us info about what the extension is for and from what files is consisted. (Related guide: XML installation files for modules).

template_thumbnail.png An image preview of the final template.

css/template_css.css Your template's CSS file. We recommend you to place it in a folder named "CSS". If you wish your template to be RTL compatible you should also create a css/template_css-rtl.css CSS file. Elxis will automatically use that CSS file when someone has selected an RTL language (like Persian or Dari).

css/index.html An empty html file used to prevent directory browsing.

Other files. Your template by 99.999% will use some images. Place that images inside an &quote;images/&quote; directory. We also recommend you to separate CSS classes that handles the site layout (classes declared in your template's index.php file) from those that format the Elxis content. So, instead of adding all your CSS inside template_css.css file, create 2 CSS files named, for instance, layout.css and customize.css, and add your css there. In template_css.css add just 2 links to these files:

@import url("layout.css"); /*layout css file*/
@import url("customize.css"); /*Use this file to customize your website*/

Last Updated Wednesday, 20 February 2008
< Previous Next >
Powered by Elxis - Open Source CMS.
Copyright (C) 2006-2008 Elxis.org. All rights reserved.
Elxis.org web site and template was created by Is Open Source (IOS)
Language:

Valid XHTML