Magic Smoke Template Design
The web user interface is constructed with templates with just a few dynamic values filled in. Those templates are found in the template/* directories. These templates are normal HTML or text with some special constructs to fill in the blanks.
Please see the Twig template engine documentation for syntax details.
There are template files for everything that is displayed on the web page and for all types of eMail sent by the MagicSmoke customer system.
Each of the example templates contains some hints what data is available. Most objects are types from the Web Object Interface.
Please see the Templates Chapter of the PHP Source Documentation.
The Twig template engine compiles the templates into PHP code before actually displaying anything. You have the choice to discard those compiled templates or to store them for faster access next time the page is called.
Allowing the web server write access to a directory opens a potential security hole. If you want to do caching more securely:
- create a storage directory in parallel to the template directory, eg. tcache, or if it already exists empty it
- make sure the directory is writable by the web server
- enter this directory into the Twig configuration:
$twigoptions=array( 'cache' => './tcache' /*...*/ );
- uncomment the "setAdminPassCode" line in config.php
- open index.php?mode=compile in a browser - it will ask you to enter the admin credentials
- the page will compile all templates it can find and store them in the configured cache directory
- restrict the directory access rights so the web server cannot write to it any more, make sure it can also not overwrite the files inside the directory
- comment out the "setAdminPassCode" line in config.php