Klondike Web Framework
Templates
Klondike currently provides levels of templating: site, directory, and page which will be automatically applied to any page request.
The file extension for a Klondike template is: '*.tpl'.
- Site
- Site templates are contained in the directory refernced in the Klondike config file
- Site templates are referenced in the config file by their directory name
- The path to the template named 'alpha' is 'path_to_template_repository/alpha'
- That directory must contain a file called 'template.tpl', which is your template file
- Klondike recognizes the following site-template variables in the template file:
- Required (must be present for Klondike to function):
- { content } -> The content for the current page to be parsed into the template
- Optional (may be hard-coded, but are typically supplied by Klondike):
- { title } -> The site's title
- { stylesheets } -> The stylesheets for the site and the current page
- { javascript } -> The javascript for the site and the current page
- { menu } -> The menu for the current page
- Misc (not typically used, but are present just in case):
- { template_path } -> The path to the template repository
- { javascript_path } -> The path to the javascript repository
- Directory
- As noted in the content section, any files that you wish Klondike to automatically access in the content repository must have a '*.kldk.*' extension. Following this standard, and the template standard, the filename for the directory template is: 'directory.kldk.tpl'
- The directory template is contained in the directory to which it applies, and is applied to all pages in that directory
- Note: Directory templates are NOT recursive
- Directory templates must contain the following variables:
- { content } -> The content for the current page to be parsed into the template
- You can specify other variables in the POM vars element which will be parsed into the template.
- Page
- As noted in the content section, any files that you wish Klondike to automatically access in the content repository must have a '*.kldk.*' extension. Following this standard, and the template standard, the filename for the page template is: 'page_id.kldk.tpl'
- The page template is contained within the same directory as the page
- However, the location for the page styles is different:
- The page repository stucture is replicated for each template in a directory called 'styles'
- For example: the styles for a page who's id is 'alpha:beta:gamma' would be:
-
- 'path_to_template_repository/template/styles/alpha/beta/gamma.css'
- This is done because the styles for a page typically change with the current template (colors, etc).
- Note: all auto templating / styling for index pages is referenced by its parent.
- For example: the styles for a page who's id is 'delta:index' would be:
- 'path_to_template_repository/template/styles/delta.css'
- NOT: 'path_to_template_repository/template/styles/delta/index.css'