Template

From Lanius CMS Wiki

Templates are an element of every website which are responsible for its design and layout. It helps to achieve the goal of a content management system: to separate a site's content from it's structure. When you employ a template, you no longer have to worry about what a page will look like when you make a change to it, or when you create it from scratch. The CMS and the template take care of that for you. In Lanius CMS you can customize view of your site, by installing additional (or modifying existing) template. There are two kinds of templates: Site Templates and Admin Templates.

  • Site Templates are templates used on the pages which your visitors can see
  • Admin Templates are templates applied only to the administration backend

Templates are managed through the responding System => Templates Manager page of the administration backend, see also Templates Manager.

Structure

This is the outline of a frontend template files/directories structure:

  • templates/ - directory containing templates in your website root
    • templatename/ - main template directory (i.e. fixdark, waverebirth etc. second your template name)
      • index.htm - blank index.htm file to prevent directory browsing
      • index.php - main template file containing structure built up with XHTML and PHP
      • template.style.css - main CSS template file
      • template.xml - template package XML descriptor, see XML formats/Templates
      • template_thumbnail.png - small snapshot (206x150 pixels) of default Lanius CMS frontpage with the template active
      • templatename/components/ - directory with per-component CSS declarations (for example, when polls component is requested the polls.style.css file will be included in output, if present)
      • templatename/drabots/ - directory with per-drabot CSS declarations (for example, dravote.style.css etc)
      • templatename/modules/ - directory with per-module CSS declarations (for example, menu.style.css)
      • templatename/images - directory with template graphics (PNG format enforced where possible)
        • boff.png
        • bon.png
        • bk.png
        • bullet.png
        • but.png
        • indent1.png
        • inputback.jpg
        • top-fill.png
        • ...

NOTE: templatename is always lowercase.

Architecture

Lanius CMS contents are processed by index.php (in the root directory of the template). Such file is a simple tabular XHTML structure which includes inside it (in certain positions) blocks of PHP code which generate the output.

The PHP code blocks have the following purposes:

 $d->ShowHead();
  • Set elements inside the head (for example to load addons CSS stylesheets or to set other general HTML page information)
 $d->PathWay();
 $d->CurrentDate();  
 echo 'Copyright © '.lc_strftime('%Y').' '.$GLOBALS['d_title']; // current year and website title
  • View some global variables (pathway, date, copyright & website title)
  if ($d->CountModules('user4')) { ?><div id="user4box"><?php $d->LoadModules ('user4'); ?></div><?php } ?>
  • Load into positions left,right,top,bottom,user1-2-3-4-5-6 the relative modules managed through the Backend
 $d->MainBody();
  • Load into the main body the currently active component

For more information about Lanius CMS architecture, read Architecture.

Related pages

Personal tools
Create a book
  • Add wiki page
  • Collections help