Creating a Template

Preachit 4.1 uses an internal templating system to govern the appearance of each of the views. This allows us to offer various templates for download and installation through the Preachit template area. This also allows a great deal of flexibility. A user can modify these files, override them through the standard Joomla html view override folders in the Joomla template. Here though we want to give some basic guidance to get you started in creating your own Preachit template.

 

Necessary files

 

Below is a list of files that are necessary to make up a template with an explanation for each. Once the template is created you will need to put the template folder into a zip file and install it through the Preachit template installer. After reading this doc you may also like to read the doc on how to access our template class api: Template class.

 

Template folder

 

The template folder must match the name given in the template.xml file

 

template_folder/template.xml

 

This is the install file and an example is given below.

 

template_folder/template16.xml

 

This is the parameters file for the template. For more information on this file please read the doc on Template parameters.

 

template_folder/css/preachit.css

 

This is the css file for the template.

 

template_folder/plugin/pluginhtml.php

 

This file will handle the look of the code inserted into articles through the preachit content plugin.

 

template_folder/booklist.php

 

The file that will deal with displaying the book list - optional. The details for the books are found in the array $this->book which contains an array of $book objects - see Preachitbook() class in file components/com_preachit/helpers/info-builder for functions that can be called on this.

 

template_folder/datelist.php

 

The file that will deal with displaying the date list - optional. The details for the dates are found in the array $this->date which contains an array of $date objects- see Preachitdate() class in file components/com_preachit/helpers/info-builder for functions that can be called on this.

 

template_folder/download.php

 

The file that will deal with displaying the download terms - optional and needs a parameter to be set to make the download link point here.

 

template_folder/messagelist.php

 

The file that will deal with displaying the message list. This file will also handle the single series and teacher view. It will also handle the single ministry view if the parameters are set to point the ministry link to the message list rather than the series list. The details for the messages are found in the array $this->messages which contains an array of $message objects - see here.

 

template_folder/ministrylist.php

 

The file that will deal with displaying the ministry list. The details for the ministries are found in the array $this->ministry - see here.

 

template_folder/serieslist.php

 

The file that will deal with displaying the series list. This file will also handle the single ministry view if the parameters are set to point the ministry link to the series list rather than the series list. The details for the series are found in the array $this->series which contains an array of $series objects - see here.

 

template_folder/taglist.php

 

The file that will deal with displaying the tag list - optional. The details for the tags are found in the array $this->tags which contains an array of $tag objects - see Preachittag() class in file components/com_preachit/helpers/info-builder for functions that can be called on this.

 

template_folder/teacherlist.php

 

The file that will deal with displaying the teacher list. The details for the teachers are found in the array $this->teachers which contains an array of $teacher objects - see here.

 

template_folder/studyview.php

 

The file that will deal with displaying the single message view. The message object is passed to this view under $this->message which is an instance of the message object - see here.

 

Install file

 

All templates need to contain an install file at location template_folder/template.xml. Here is an example of the template install file. Please note the name in the file must match the name of the template_folder.

 

<?xml version="1.0" encoding="utf-8"?>

<install type="pitemplate">

<name>Chameleon</name>

<author>te-webdesign</author>

<authorUrl>te-webdesign.org.uk</authorUrl>

<creationDate>February 2011</creationDate>

<version>4.1.0 beta</version>

<piversion>4.1</piversion>

<license>GNU/GPL</license>

 

<core>

<folder>js</folder>

<folder>plugin</folder>

<folder>helpers</folder>

<file>index.html</file>

<file>booklist.php</file>

<file>datelist.php</file>

<file>messagelist.php</file>

<file>ministrylist.php</file>

<file>serieslist.php</file>

<file>studyview.php</file>

<file>taglist.php</file>

<file>teacherlist.php</file>

<file>template.xml</file>

<file>template16.xml</file>

</core>

<style>

<file>params.ini</file>

<folder>css</folder>

<folder>styles</folder>

</style>

<languages folder="language">
          <language tag="en-GB" location="site" folder="site">en-GB/en-GB.pitmpl_chameleon.ini</language>
          <language tag="en-GB" location="admin" folder="admin">en-GB/en-GB.pitmpl_chameleon.ini</language>
  </languages>

 

</install>

 

All folders and files specified within the 'core' tags will be installed time the template files that are installed. The folders and files specified under the 'style' tags will only be installed when the user selects a complete install rather than an update install. This allows you to modify core files in the template without overwriting style changes that have been made.


Preachit templates also allow you to install template specific language files for the admin and for the site area. To do this add the lanugage tags as above in the template.xml file and place the files in a folder labelled 'language/site' and 'language/admin'.

Cron Job Starts