Template Installer Script User Guide
This user guide is for people who want to use the Template Installer Script for ExpressionEngine to create their own custom template installation. Instructions for installing eeSiteKit are found here.
The Template Installer Script has 3 sections:
- The script is in the “index.php” file and it’s here that you can set the variable for the Installer Name if you are custom branding the installer.
- The configurable files for custom branding your installer are in the “interface” file.
- All your custom template files will go in the folder called “files”
Configuring the Template Installer Script
- /index.php - This file contains the installer script. There is one variable at the very top of the scrip’s code you might want to reconfigure for your specific use. Near line 27 you can reset the name of the template theme you will be installing. By default, it is set to eeSiteKit. The Theme Template Installer uses the name you set in this variable throughout the installer interface.
$variables['installer_name'] = 'eeSiteKit'; - /interface/ - The interface is where the Theme Template Installer’s own theme and text may be styled to meet your needs. These files are embedded into the “index.php” script as needed. These files may be edited in any text editor. By default, the Theme Template Installer uses an online CSS file at this site. You may want to create your own CSS file for offline/local installs.
/files/ - The files folder is where you will add all of your own custom templates. The Site Installer script is expecting a very specific file naming structure and it must be followed if you want this to work smoothly for you. It’s recommended that you first open all the sample files that come with the Theme Template Installer to see how things are set up before you replace them with your own.
- Within the /files/ folder you will need to create one sub-folder for each of your template groups.
- The /files/ sub-folders need to be named “template_group_name.group”. Each sub-folder’s name will end with the “.group” suffix.
- Inside of each /files/ sub-folder you’ll need to add a copy of the “default.prefs” file. This is where you can override EE’s default preferences for that folder’s template group. Here’s an example of the code for a template group preferences file “default.prefs”:
<?php $template_group_defaults = array( 'is_site_default' => 'n', 'is_user_blog' => 'n' ); $template_defaults = array( 'save_template_file' => 'n', 'template_notes' => '', 'cache' => 'n', 'refresh' => '0', 'no_auth_bounce' => '', 'enable_http_auth' => 'n', 'allow_php' => 'n', 'php_parse_location' => 'o', 'hits' => '0' ); ?> If you also need to override any of the default preferences for a specific template, you may add a template-specific file with the suffix “.prefs”. For example, if you wanted to override some template preferences for a template called “header.html” you would add a template preferences file called “header.prefs”. In this optional file, you only need to set variables for those default settings you wish to override. Here is an example of some of the template settings you might override:
<?php $custom_prefs = array( 'cache' => 'n', 'refresh' => '0', 'enable_http_auth' => 'n' 'allow_php' => 'n', 'php_parse_location' => 'o', 'hits' => '0', ); ?>- Inside of each template group folder you’ll add a file for each one of the templates within that group.
Each file will be named with the template_name and its template type as the suffix. For example:
header.html
blog_comments.html
footer.html
screen_css.css
navigation_js.js- /images/ - You may also create a folder called “images” and add to it any images (and image sub-folders) associated with your custom theme. When you upload your custom Theme Template Installer for use, you will want to set the permissions on this one folder to 777 in order for the images install to work in most hosting environments.
- Finally, add the code you want into each of your new files and be sure to test the installer a time or two to confirm you’ve got everything set up just the way you like it.
