Theme Development


This section is for people interested in customizing the look and feel of Form Tools. The most important thing you need to know about is smarty.


All HTML content in Form Tools 2 is generated via Smarty Templates. Smarty is a web application that's bundled with Form Tools. With Form Tools 2, instead of constructing the HTML in PHP, Smarty helps remove the HTML (and other dynamic content) into separate files that contain Smarty placeholders and logic. The template is then called and processed from within the Core code, resulting in a final webpage or whatever content is needed.

Smarty is used not just for the HTML webpages, but the emails content (HTML + text), language file strings - virtually everything. The benefits to using Smarty are too many to enumerate: it's fundamentally a better approach that the previous method of intermingling the HTML and PHP. What's more, we didn't just use Smarty for our own convenience: this decision affects all users of Form Tools - be they theme developers, module developers or just administrators constructing emails through the Form Tools UI. It makes everyone's job easier.

But the primary, original purpose of using Smarty was to allow Form Tools to be skinned with themes. The last of customizability of the Form Tools 1 UI was a significant drawback. We included some simple options to define the CSS and main image, but it was very basic. The new theme-based approach has no limitations.

Themes encompass the visual presentation of the entire script: client pages, administrator pages, modules pages alike. It was designed to be easily extended, letting you create your own themes very quickly. This can be invaluable if you need to skin the UI for a client, making it look consistent with their own website. As with Form Tools 1.x, Form Tools 2 is completely brandable: we don't make you include links to our website or even mention we wrote the thing. Two thumbs up for open source!

Themes + Overriding Pages

Themes work by overriding pages already defined in the default theme. The default theme (discussed next) contains all theme pages needs to display the entire Form Tools application. Other themes work by only overriding those pages required for whatever type of presentation you have in mind. This keeps themes as small as possible, and makes the increasingly likely of being compatible with future versions of the script.

On that note, generally it's a good idea to only override the main "special" templates (discussed later) not individual pages within the Form Tools UI. This is because future versions of the script are apt to make changes to individual pages, whereas the core pages are more probable to remain unchanged. But even if you do need to do this, no problem! The Form Tools website logs different versions of your theme for you, so you can map specific versions to particular versions of the Form Tools Core, ensuring your theme works in all cases.