Difference between revisions of "Creating and Understanding Themes"

From Online Manual

Jump to: navigation, search
(Join lots of stubs to make an article.)
(No difference)

Revision as of 09:11, 16 April 2011

Introduction

There comes a time, when a user has become experienced with SMF, that they may wish to start developing their own themes. In this introduction, there is some useful information, for creating custom themes.

Recommendations for users, to create themes:

  • Some knowledge of PHP basics
  • Good knowledge of HTML (Hyper Text Mark-up Language)
  • Good knowledge of graphics creation and optimizing
  • Some inspiration


Quickstart

To be able to create a theme, the user first needs administration privileges on the SMF install that they are using. They would need to follow this path through their admin panel:

Administration Center > Configuration > Themes and Layout > Manage and Install

The Install a New Theme dialog contains three fields to take look at. The user can install a new Theme from a file, from a directory on the server, or create a copy of the default theme. If they want to create a new theme, they can ignore installing a Theme from a file, or from a directory on the server; these are mainly used for packed distributed themes. The user needs the "Create a copy of Default named" field. Here, they can change the name to whatever they want, or they can leave it as it is. They should select "Install!" and select "OK" for any dialog boxes that may appear - their new Theme should be up and running. A copy of a Default theme will not copy the whole Theme - instead it just copies the following files:

  • index.php
  • index.template.php
  • index.css
  • theme.js

the directory images and creates the file theme_info.xml.

If they wanted to change anything else, apart from the overall look of the Forum header and footer or the stylesheet, they would have to add the corresponding file (or template) into their new theme's directory. Say the user wanted to change something on the Board index, or completely redesign it. They would need to copy BoardIndex.template.php from the Default theme into their new theme's directory.

Themes "fall back" to the default version of a template if that template file cannot be found in the current theme's directory. This is why only few files are included in the user's new Theme to begin with - if they are only changing how the Forum will look overall, the theme will pull the other template files and images from the default theme. This makes it a lot easier to upgrade a SMF forum without having to rewrite the parts of the user's theme they did not change anyway.


What is a theme

A Theme is the look and feel of the forum. Themes can be switched by members, and usually have HTML, CSS, JavaScript, and images. Themes control virtually every visual aspect of SMF, allowing easier customization.


What is the default theme, and what is it there for?

The "Default" theme is actually not the "default theme." While SMF starts out with it as the base theme, the "Default" theme is only a collection of the default templates. These templates are "fallbacks" in case the current theme does not have the correct template.

It is similar to URLs - if the base domain name isn't specified, (in example, just /style.css) it uses the default (making the URL, www.simplemachines.org/style.css). In this case, it works a bit different, but the concept is similar.