Theme-info.xml

From Online Manual

Jump to: navigation, search

When you create a theme, you can decide to package your theme in order to upload it to the SMF Theme Site and allow other users to install your theme on their forum. One of the files that you need when packaging your themes is "theme-info.xml". The "theme-info.xml" file keeps data stored in it of things such as the theme name, the creator, and contact details. Here is an example of a "theme-info.xml" file taken from the "iGuides Theme".


<?xml version="1.0"?>
<theme-info xmlns="http://www.simplemachines.org/xml/theme-info" xmlns:smf="http://www.simplemachines.org/">
	<!-- For the id, always use something unique - put your name, a colon, and then the package name. -->
	<id>smf:iguides_theme</id>
	<version>2.0 RC1.2</version>
	<!-- Theme name, used purely for aesthetics. -->
	<name>iGuides Theme</name>
	<!-- Author: your email address or contact information. The name attribute is optional. -->
	<author name="Simple Machines">info@simplemachines.org</author>
	<!-- Website... where to get updates and more information. -->
	<website>http://www.simplemachines.org/</website>
	<!-- Template layers to use, defaults to "main". -->
	<layers>html,body</layers>
	<!-- Templates to load on startup. Default is "index". -->
	<templates>index</templates> 
	<!-- Base this theme off another? Default is blank, or no. It could be "default". -->
	<based-on></based-on>
</theme-info>

At first, this file may seem hard to understand. But all those tags are there to organize the information so that even a computer can understand it. All of the text between the <!-- and --> tags are comments. They are there for people to read, and won't affect how the file is interpreted by a computer. You can remove them when you know what each field does. You can open "theme-info.xml" in any normal text editor, and you can find the file in the root directory of your theme.


<?xml version="1.0"?>
<theme-info xmlns="http://www.simplemachines.org/xml/theme-info" xmlns:smf="http://www.simplemachines.org/">

The first two lines here show that the XML Version of the file is 1.0, and that it is a theme-info file - which allows SMF to read it. Do not edit this, you do not need to, and chances are that it will break the file.

<!-- For the id, always use something unique - put your name, a colon, and then the package name. -->
<id>smf:iguides_theme</id>

These two lines tell you who made the theme, and what the theme is called. This is mainly used when uploading your theme to the SMF Theme Site, but it's recommended that you fill it in anyway. As the comments say, your name, a colon, then the theme name.

This line tells you what version of SMF this theme is made for. By default, it is the version of SMF that you installed the theme from, in this case, SMF 2.0 RC1.2. Obviously, if you make the theme for SMF 1.1.X, it won't work on SMF 2.0, unless it's image changes and you do not include the "index.template.php" file. You cannot just change this piece of code and expect the theme to work for another version of SMF.

<!-- Theme name, used purely for aesthetics. -->
<name>iGuides Theme</name>

As you could guess from this, this is the theme name. This appears where the user decides to change their theme, and in the Admin Panel where you can set the default theme, and reset the themes... This can use spaces, so does not have to have underscores or have it as one long word. When you copied the default theme, you chose the name of the theme then. However if you want to change it again, this is the place.

<!-- Author: your email address or contact information. The name attribute is optional. -->
<author name="Simple Machines">info@simplemachines.org</author>

This decides who the author is. It includes your EMail Address, so people can contact you, aswell as your name. In the "Latest and Greatest Themes" in your Admin Panel, it has the theme name, followed by the author name. The author name there has a "mailto" link to the EMail Address that you put in here. That means that if someone likes your theme or wants to contact you about something, they can by using that Address.

<!-- Website... where to get updates and more information. -->
<website>http://www.simplemachines.org/</website>

This is your website URL. If a user wants to get updates for your theme, or maybe small theme hacks for it,

<!-- Template layers to use, defaults to "main". -->
<layers>html,body</layers>

Within the themes template files, you have layers. The layers are like <html>, <body> tags, etcetera. As by default, the html and body layers are the two that only really needed to be used, but as you get better with theming, you will learn about the other layers that you can put in there.

<!-- Templates to load on startup. Default is "index". -->
<templates>index</templates>

You do not really need to change this. You know you have "something.template.php" files in your theme directory? This bit of code tells it to load any specific templates, on startup. What is already in there, "index" is perfect for it, because that then calls all other templates when they are needed.

<!-- Base this theme off another? Default is blank, or no. It could be "default". -->
<based-on></based-on>

If you've based your theme off of something, or another theme, then this is the place to put it. If you just thought it up out of your head, then you can leave this blank.

</theme-info>

This signifies the end of the "theme-info" file, so that SMF will stop reading the file from there on.


So now that you know about the functions that "theme-info.xml" uses and has, so try creating your own by editing the current one you have. You do not have to do this, but alot of people do, and it makes it seem clearer. Remove the "'" tags and the content of them. That frees up seven lines and make it alot easier to see and read. Then edit the rest so it suits your theme. This is what the iGuides "theme-info.xml" ends up as.

<?xml version="1.0"?>
<theme-info xmlns="http://www.simplemachines.org/xml/theme-info" xmlns:smf="http://www.simplemachines.org/">
	<id>iKorp:iGuidesTheme</id>
	<version>2.0 RC1.2</version>
	<name>iGuides Theme</name>
	<author name="iKorp">adminstrator@ikorp.net</author>
	<website>http://www.ikorp.net/</website>
	<layers>html,body</layers>
	<templates>index</templates>
	<based-on></based-on>
</theme-info>