Actions

Difference between revisions of "Creating a basic templateDetails.xml file"

From Joomla! Documentation

m
 
(16 intermediate revisions by 9 users not shown)
Line 1: Line 1:
The templatedetails.xml file is essential. Without it, your template won't be seen by Joomla!. The file holds key "metadata" about the template.  
+
{{Version/tutor|2.5,3.1}}
 +
The <tt>templateDetails.xml</tt> file is essential. Without it, your template won't be seen by Joomla!. The file holds key [[Wikipedia:Metadata|metadata]] about the template.  
  
Lets look at an example:
+
The syntax of the file is different for each Joomla version.
  
<pre>
+
For {{JVer|3.x}} and later, use the following version. Change <code>version="2.5"</code> in the extension tag into the version of your Joomla! installation (3.1 etc) or the minimum version that you wish to support.
 +
 
 +
<source lang="xml">
 +
<?xml version="1.0" encoding="utf-8"?>
 +
<extension version="2.5" type="template">
 +
<name>mynewtemplate</name>
 +
<creationDate>2008-05-01</creationDate>
 +
<author>John Doe</author>
 +
<authorEmail>john@example.com</authorEmail>
 +
<authorUrl>http://www.example.com</authorUrl>
 +
<copyright>John Doe 2008</copyright>
 +
<license>GNU/GPL</license>
 +
<version>1.0.2</version>
 +
<description>My New Template</description>
 +
<files>
 +
<filename>index.php</filename>
 +
<filename>templateDetails.xml</filename>
 +
<folder>images</folder>
 +
<folder>css</folder>
 +
</files>
 +
<positions>
 +
<position>breadcrumb</position>
 +
<position>left</position>
 +
<position>right</position>
 +
<position>top</position>
 +
<position>user1</position>
 +
<position>user2</position>
 +
<position>user3</position>
 +
<position>user4</position>
 +
<position>footer</position>
 +
</positions>
 +
</extension>
 +
</source>
 +
 
 +
For {{JVer|1.5}}, use the following:
 +
 
 +
<source lang="xml">
 
<?xml version="1.0" encoding="utf-8"?>
 
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 1.5//DTD template 1.0//EN" "http://dev.joomla.org/xml/1.5/template-install.dtd">
+
<!DOCTYPE install PUBLIC "-//Joomla! 1.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.5/template-install.dtd">
 
<install version="1.5" type="template">
 
<install version="1.5" type="template">
 
<name>mynewtemplate</name>
 
<name>mynewtemplate</name>
<creationDate>1/5/08</creationDate>
+
<creationDate>2008-05-01</creationDate>
<author>Joe Bloggs</author>
+
<author>John Doe</author>
<authorEmail>Joe@bloggs.com</authorEmail>
+
<authorEmail>john@example.com</authorEmail>
<authorUrl>http://www.joebloggs.com</authorUrl>
+
<authorUrl>http://www.example.com</authorUrl>
<copyright>joe bloggs 2008</copyright>
+
<copyright>John Doe 2008</copyright>
 
<license>GNU/GPL</license>
 
<license>GNU/GPL</license>
 
<version>1.0.2</version>
 
<version>1.0.2</version>
Line 19: Line 56:
 
<filename>index.php</filename>
 
<filename>index.php</filename>
 
<filename>templateDetails.xml</filename>
 
<filename>templateDetails.xml</filename>
<filename>template_thumbnail.png</filename>
+
<folder>images</folder>
<filename>images/background.png</filename>
+
<folder>css</folder>
<filename>css/css.css</filename>
+
 
</files>
 
</files>
 
<positions>
 
<positions>
Line 34: Line 70:
 
<position>footer</position>
 
<position>footer</position>
 
</positions>
 
</positions>
 
 
</install>
 
</install>
</pre>
+
</source>
  
So, as you can see, we have a set of information between markup tags ( the <thing> ). Your best approach is to cut and paste this into your "templatedetails.xml" file and change the relevant bits (such as <name> <author> ).
+
So, as you can see, we have a set of information between markup tags (the <code><element></code>s). Your best approach is to cut and paste this into your <tt>templateDetails.xml</tt> file and change the relevant bits (such as <code><name></code> and <code><author></code>).
  
The <files> part should contain all the files that you use - you possibly don't know what they are called yet - don't worry update it later.
+
The <code><files></code> part should contain all the files that you use - you possibly don't know what they are called yet - don't worry, update it later. The <code><folder></code> element can be used to define an entire folder at once.
  
 
Leave the positions as they are - these are a common set so you will be able to switch easily from the standard templates.
 
Leave the positions as they are - these are a common set so you will be able to switch easily from the standard templates.
 +
[[Category:Template Development]]
 +
[[Category:Tutorials]]

Latest revision as of 09:00, 30 September 2013

The templateDetails.xml file is essential. Without it, your template won't be seen by Joomla!. The file holds key metadata about the template.

The syntax of the file is different for each Joomla version.

For Joomla 3.x and later, use the following version. Change version="2.5" in the extension tag into the version of your Joomla! installation (3.1 etc) or the minimum version that you wish to support.

<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="template">
        <name>mynewtemplate</name>
        <creationDate>2008-05-01</creationDate>
        <author>John Doe</author>
        <authorEmail>john@example.com</authorEmail>
        <authorUrl>http://www.example.com</authorUrl>
        <copyright>John Doe 2008</copyright>
        <license>GNU/GPL</license>
        <version>1.0.2</version>
        <description>My New Template</description>
        <files>
                <filename>index.php</filename>
                <filename>templateDetails.xml</filename>
                <folder>images</folder>
                <folder>css</folder>
        </files>
        <positions>
                <position>breadcrumb</position>
                <position>left</position>
                <position>right</position>
                <position>top</position>
                <position>user1</position>
                <position>user2</position>
                <position>user3</position>
                <position>user4</position>
                <position>footer</position>
        </positions>
</extension>

For Joomla 1.5, use the following:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 1.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.5/template-install.dtd">
<install version="1.5" type="template">
        <name>mynewtemplate</name>
        <creationDate>2008-05-01</creationDate>
        <author>John Doe</author>
        <authorEmail>john@example.com</authorEmail>
        <authorUrl>http://www.example.com</authorUrl>
        <copyright>John Doe 2008</copyright>
        <license>GNU/GPL</license>
        <version>1.0.2</version>
        <description>My New Template</description>
        <files>
                <filename>index.php</filename>
                <filename>templateDetails.xml</filename>
                <folder>images</folder>
                <folder>css</folder>
        </files>
        <positions>
                <position>breadcrumb</position>
                <position>left</position>
                <position>right</position>
                <position>top</position>
                <position>user1</position>
                <position>user2</position>
                <position>user3</position>
                <position>user4</position>
                <position>footer</position>
        </positions>
</install>

So, as you can see, we have a set of information between markup tags (the <element>s). Your best approach is to cut and paste this into your templateDetails.xml file and change the relevant bits (such as <name> and <author>).

The <files> part should contain all the files that you use - you possibly don't know what they are called yet - don't worry, update it later. The <folder> element can be used to define an entire folder at once.

Leave the positions as they are - these are a common set so you will be able to switch easily from the standard templates.