The Theme Engine
Yet another template-like feature of Vanilla is the Theme Engine - a system similar to WordPress themes whereby the whole look and feel of the site is contained within its own folder on the server. Themes can be applied across all pages (global), on a per-page basis, or as the links below show, overridden via a query string value.
Click a link below to load this page with a different theme:
What's Makes a Theme?
Each theme consists of:
- A config.php file - to tell Vanilla about the theme (name, number of layouts etc.)
- Any number of 'layout' files (similar to a template)
- A 'css' directory
- An 'images' directory
- A 'js' directory (for additional JavaScript beyond the core files)
What are Layouts?
Each theme can have any number of different layouts - 'single column', 'two columns' or 'newspaper' for example - you can call them whatever you want. Layouts are defined in the config.php file and take the form of an array containing:
- ID - should start at zero and increment by 1 for each layout
- Title - the title of your layout design - e.g. 'My Layout'
- File - the actual name of the physical file - e.g. 'my_layout.php'
- NavCSS - the navigation css file for this layout
- CSS - the main CSS file for this layout
- Logo - the name of the logo image file for this layout - e.g. 'logo.gif'
Note - Every theme should have at least one layout defined in its config.php file.
Adding New Themes
The system comes with a few themes already built-in. To add a new theme to the system, simply upload your files into a new directory within the 'themes' folder. If anything goes wrong, you should receive various helper messages explaining what the problem might be.
The__Syntax__
We've used a simple syntax to denote placeholders within theme engine layout files: __example__. This allows users to combine themes with other Vanilla placeholder types such as {Smart Tags}, [Mail Form], [Media Gallery], [List Directories] and FooBank™ variables.
PHP Theme Support
All theme layout files are written in PHP. This means that you can include extra server-side code into your theme files, along with JavaScript, to manipulate page elements at runtime. For example, in this alternative theme, we've added jQuery to change the menu behaviour (animation), hide the breadcrumbs and accessibility toolbar and change the positioning of the logo. The majority of the styling is achieved via the theme's CSS file.
Failover Support
If a theme file cannot be found or loaded, the system falls back to the default theme. If this too fails, the system will quit the Theme Engine and attempt to serve up regular, non-themed pages.
Last updated: 16/05/2012

