Packaging a Theme From Online Manual

Jump to: navigation, search

After you've developed a Theme for SMF, you may wish to give it to someone else so they can install it themselves, or enter a contest, etc. This requires you to do a few simple things to "package" your Theme and make it installable. There are three steps - theme_info.xml, Settings.language.php, and the archive format you use to distribute it.

Customizing the theme_info.xml File

On the Theme-info.xml page you will find a sample file. It contains a few comments, and a basic outline for that theme. The elements in it all have particular meanings and uses, but most of them are just for display purposes. The name is possibly the most important thing in this file. With it you can specify the name used for your Theme (fancy that!) throughout SMF, at least by default.

The author and website are there just to clarify things, and are not actually used when displaying the name of the theme. It is still recommended that you specify them, such that people can more easily tell which Theme is which.

Both the layers and templates options are very important; but in most cases, they can be left at what you see in the example file. The layers option defines the default set of layers to display on every page, comma delimited. For example, to show the 'site' layer and then the 'main' layer, you would put 'site,main' under that option. The templates option specifies which templates should be loaded on every page view, such as 'index' or 'index,Important,Admin'. However, that is fairly advanced. In most cases, 'main' and 'index' are fine.

The based-on option is currently reserved for later use, but you can put 'default' there to specify that your Theme expects the images_url and theme_url to be set to those of the default theme. In later versions of SMF, this feature may give you the option to load missing templates from a Theme other than default, which is currently always the case.

For more information, see Theme-info.xml

Language Files Make the World Go Round

To make it easier to internationalize (translate) themes, their descriptions are stored in the same place other translatable things are; in the language files. Specifically, the Settings language file is used here.

There are only two important strings to be specified in the Settings language file. They are theme_thumbnail_href and theme_description. The latter is used for the description, and should be rather self-explanatory. The thumbnail URL is specified in the other one, to make it possible to use your own image filename.

Packaging and Distributing

The last step is compressing all the files into an archive. You should compress your Theme into a .tar.gz (gzip) or .zip (zip) file, with the files and directories inside your Theme in the "root" of the zip file. This means that your archive might have contents similar to:

  • index.php
  • index.template.php
  • images/
  • css/
  • scripts/
  • theme_info.xml

Important is that these files are not in a subdirectory inside the archive. You can test this by extracting it to a directory and checking to see if the files are in that directory itself, or in a directory under that directory. After this, you're done. A little complicated, perhaps, but it's a lot easier the second time. Good luck!