Template Integration

Click here for a practical guide on how we integrated the demo's templates with a custom web layout.

The first thing that you need to know about the template system is that it doesn't use physical files. All of the template content is stored directly in the database. For this reason, you should never try to alter any physical files on your server in an attempt to change the appearance of your program. Instead, all template changes should be made from your administrative control panel:

  • Templates » HTML Templates

The only exception to this rule is the style sheet, which is located at "/custom/style.php". However in general you will not need to change this file.

How Templates Are Rendered

In all cases, templates are rendered in the following manner:

  • Header
  • Template for the page being viewed
  • "Sub-Templates" (if any)
  • Footer

So for example, to render a registration page, the program would do the following:

  • Header
  • Template: Registration Page
  • %fields% caller tag renders "Linked Template: Registration: Component Set"
  • %fields% caller tag renders "Linked Template: Registration: Field" once for each field on the form.
  • Footer

Caller Tag System

The caller tag system is a "search and replace" feature that the program uses to dynamically populate information on the template. Each template has its own set of unique caller tag.

So for example, if you wanted to place a user's first name at the top of an outgoing email, you could add %first_name% to the e-mail's body and the program will automatically make the change for you.

For more information on the caller tag system, please click here.

Best Practices: Path Formatting

Use absolute paths for images, style sheets, and javascript. This means starting paths with a forward slash.

Bad Practice

<img src="images/logo.png" border="0" alt="Logo" />
<link href="data/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="functions/general_functions.js"></script>

Good Practice

<img src="/images/logo.png" border="0" alt="Logo" />
<link href="/data/style.css" rel="stylesheet" type="text/css" />
<script language="javaccript" src="/functions/general_functions.js"></script>

Required Components

Some templates have components that are required for them to function properly. Click on the "templates" link to the left to browse the various templates. We strongly recommend that you read through the header and footer article if you plan on integrating your custom header and footer with Member Guardian.

Including External PHP Scripts on Templates

You can include a custom PHP file on any template in the following manner:

<mg_include>/full/server/path/to/file.php</mg_include>

Restoring "Broken" Templates

Note that doing this will overwrite all of your previous changes to the template you choose to restore. Proceed with caution!

You can restore a template at any time from the admin control panel from "Templates » HTML Templates" and "Templates » Email Templates".

Restoring All Templates

  • Click on "Restore All Original Templates"

Restoring a Specific Template

  • Select the template you wish to restore from the "Select a Template" section.
  • Click on "Restore Original Template"

Manual Restore

If the above links do not work, cURL is most likely not working on your server (you should contact your web host to have this resolved). However, in the mean time, you can find the latest templates in their "raw" state here. Just copy and paste the content of the template you are trying to restore into your admin control panel template editor.