templateDetails.xml
The templateDetails.xml file acts as a manifest, or
packing list, that includes a list of all the files or
folders that are part of the template. It also includes
information such as the author and copyright. Some of these
details are shown in the administrative backend in the
Template Manager. An example of an XML file is shown
here:
NOTE - If you are following along and creating the
template as you read, at this point, you should open up a
text editor, create a file called templateDetails.xml, and
make sure it includes the code shown here.
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="template">
<name>TemplateTutorial15</name>
<creationDate>August 2007</creationDate>
<author>Barrie North</author>
<copyright>GPL</copyright>
<authorEmail> compassdesigns@gmail.com </authorEmail>
<authorUrl>www.compassdesigns.net</authorUrl>
<version>1.0</version>
<description>First example template for Chapter 9 of the Joomla
Book</description>
<files>
<filename>index.php</filename>
<filename>templateDetails.xml</filename>
<filename>favicon.ico</filename>
<folder>css/</folder>
<folder>images/</folder>
<folder>js/</folder>
</files>
<positions>
<position>user1</position>
<position>top</position>
<position>left</position>
<position>banner</position>
<position>right</position>
<position>footer</position>
</positions>
<params>
<param name="colorVariation" type="list" default="white"
label="Color Variation" description="Color variation to use">
<option value="blue">Blue</option>
<option value="red">Red</option>
</param>
</params>
</install>
Let's look at what some of these lines mean:
<INSTALL VERSION="1.5" TYPE="template">—The
contents of the XML document are instructions for the
backend installer. The option type="template" tells the
installer that you are installing a template and that it is
for Joomla 1.5.
<name>TemplateTutorial15</name>—This line
defines the name of your template. The name you enter here
will also be used to create the directory within the
templates directory. Therefore, it should not contain any
characters that the file system cannot handle, such as
spaces. If you're installing manually, you need to create a
directory whose name is identical to the template name.
<creationDate>August 2007</creationDate>—This
is the date the template was created. It is a free-form
field and can be anything such as May 2005, 08-June-1978,
01/01/2004, and so on.
<author>Barrie North</author>—This is the
name of the author of this template—most likely your
name.
<copyright>GPL</copyright>Any copyright
information goes in this element.
<authorEmail>compassdesigns@gmail.com</authorEmail
>This is the email address at which the author of
this template can be reached.
<authorUrl>http://www.compassdesigns.net</
authorUrl>This is the URL of the author's website.
<version>1.0</version>This is the version
of the template.
<files></files>This is a list of
various files used in the template. The files used in the
template are laid out with <filename> and
<folder> tags, like this:
<files>
<filename>index.php</filename>
<filename>templateDetails.xml</filename>
<filename>favicon.ico</filename>
<folder>css/</folder>
<folder>images/</folder>
<folder>js/</folder>
</files>
The "files" sections contain all generic files, such as
the PHP source for the template or the thumbnail image for
the template preview. Each file listed in this section is
enclosed by <filename> </filename> tags. You can
also include whole folders, such as an image folder, by
using the <folder> tag.
<positions></positions>This shows the
module positions available in the template. It is the list
of page locations, such as top, left, and right, defined in
the template in which modules can be set to appear, using
the Position drop-down of the Module Manager. The position
names in this list must precisely match the PHP code that
generates content for each listed position inside
index.php.
<params></params>This section describes
the parameters that can be set in the backend and passed as
global variables to allow advanced template functions, such
as changing the color scheme of the template.
Creating a Simple Joomla Template
What Is a Joomla! Template?
index.php
|