Home

Download this help site
(PDF 80MB)

Download

Theme and page generation process

This functionality is only intended for experienced web designers

Icon

Please read this page before you proceed: Advanced customization warning
Theme override is intended for people with advanced web design skills. Incorrect use may result in your website malfunctioning.
Note: our technical support team does not provide support related to theme overrides.

Your web pages on your Wild Apricot site are generated on the fly using your site's theme together with any theme overrides. The actual process by which each site page is generated is as follows.

1. Theme assembly

The theme will be assembled as follows:

  1. System reads config file of currently selected theme (MainConfig.cfg).
  2. If there is a <ParentId> option set, it reads config file of parent theme. The process repeats until system encounters parentless theme (the root theme).
  3. All files from root theme are copied to special assembly folder.
  4. All files from child themes are copied to the same folder, overwriting parent files.
  5. Files from Theme_overrides folder are copied to the same folder.

2. Gadget assembly

  1. Gadgets and controls are copied to theme directory under Gadgets and Controls folders accordingly.
  2. Files from Theme_overrides folders are copied to the same folders.

3. CSS and JavaScript parsing

  1. Style sheets and JavaScripts are loaded from Head.tpl, included in MainTemplate.tpl.

4. StringTemplate page parsing

  1. System reads MainTemplate.tpl file located in the root of assembled theme. This file is an entry point for theme rendering.
  2. System parses MainTemplate.tpl, replacing all <$...$> constructions with their values.
  3. If the system finds a <$templateName()$> construction, it opens templateName.tpl file, parses it with StringTemplate engine and adds its content to resulting HTML.
  4. <$LAYOUT$> construction is replaced it with master layout file, currently located in Layouts/LayoutsTemplate.tpl and is parsed.
  5. <$Gadget name="gadgetName"$> tags are replaced with corresponding gadgets code and parsed. Entry point for every gadget is GadgetTemplate.tpl file.
  6. <$CONTENT$> tag is replaced with content of current page from the page content database.

The page is now complete and is sent to the browser to be displayed.

Theme inheritance

Inheritance allows you to pass attributes from one template to another child template.  Let's imagine the following situation:

We have a theme Theme1 which has no parents (e.g,. it is standalone theme).
Here's an example of key theme files structure:

Now, let's say we have Theme2 theme, and its parent is Theme1 theme. We set the theme's parent in theme config file.
It's file structure would look like this:

When theme builder builds your theme, first it loads all the files from your parent theme and then it loads all the files from your theme. The files from your theme will overwrite any files with the same name in the parent theme. The final result is an assembled theme and consists of all files from parent theme overwritten by sibling themes. In our example, here's full assembled file structure of Theme2 theme:

You can go even further and create third level of inheritance.

On this page: 

  • No labels
 
Wild Apricot Inc. 144 Front Street West Suite 725, Toronto, Ontario, Canada M5J 2L7