Theme-info.xml: Difference between revisions From Online Manual

Jump to: navigation, search
(A little more info on based-on)
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 21: Line 21:
</theme-info></nowiki>
</theme-info></nowiki>
}}
}}
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 '''<nowiki><!--</nowiki>''' and '''<nowiki> --></nowiki>'''  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.
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 '''<nowiki><!--</nowiki>''' and '''<nowiki> --></nowiki>'''  tags are comments. They are there for people to read, and will not 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.


----
----
Line 33: Line 33:
{{code|1=<nowiki><!-- For the id, always use something unique - put your name, a colon, and then the package name. -->
{{code|1=<nowiki><!-- For the id, always use something unique - put your name, a colon, and then the package name. -->
<id>smf:iguides_theme</id></nowiki>}}
<id>smf:iguides_theme</id></nowiki>}}
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.
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 is 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.
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 will not work on SMF 2.0, unless its 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.




Line 65: Line 65:
{{code|1=<nowiki><!-- Base this theme off another? Default is blank, or no. It could be "default". -->
{{code|1=<nowiki><!-- Base this theme off another? Default is blank, or no. It could be "default". -->
<based-on></based-on></nowiki>}}
<based-on></based-on></nowiki>}}
If you've based your theme off of something, or another theme, then this is the place to put it. This will make your theme load certain files from the one indicated here. If you just thought it up out of your head, then you can leave this blank.
If you have 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.




Line 74: Line 74:
----
----


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 "''<!--''" and "''-->''" 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.
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 <nowiki>"''<!--''" and "''-->''"</nowiki> tags and the content of them. That frees up seven lines and make it a lot easier to see and read. Then edit the rest so it suits your theme. This is what the iGuides <nowiki>"''theme-info.xml''"</nowiki> ends up as.


{{code|1=<nowiki><?xml version="1.0"?>
{{code|1=<nowiki><?xml version="1.0"?>

Latest revision as of 16:22, 17 July 2018

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">[email protected]</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 will not 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 is 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 will not work on SMF 2.0, unless its 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">[email protected]</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 have 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.



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 "''<!--''" and "''-->''" tags and the content of them. That frees up seven lines and make it a lot 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">[email protected]</author>
	<website>http://www.ikorp.net/</website>
	<layers>html,body</layers>
	<templates>index</templates>
	<based-on></based-on>
</theme-info>


Advertisement: