Please click here if you are not redirected within a few seconds.
CMS Templates ›
CMS Templates

Templates are simply PHP views with some well defined PHP variables available. However, the ability to define and easily apply various templates is what makes our CMS so powerful.

Here is a simple template:

<!DOCTYPE html>
<html lang="en">
  <title><?=$title?> ›</title>
  <link href="/assets/css/studies.css" rel="stylesheet" type="text/css">
   <!-- Dynamic content goes here -->
   <?= $content ?>
  <div id="sidebar">
   . . .
  <script type="text/javascript" src="/assets/js/jquery"></script>
  <!-- Dynamic scripts are inserted here -->
  <!-- Dynamic tail is inserted here -->

The data from the scripts tab of the Page Editor is inserted into the page just before the closing </body> tag.

The data from the content tab is assigned to the $content PHP variable.

The title from the metadata tab is assigned to the $title PHP variable.

There are other PHP variables defined for each page. Find a complete list of the variables that may be used in templates in the sidebar.

Template File Conventions

Each template file must:

Template List

In the Page Editor, on the Metadata tab, there is a drop-down list labelled Layout.

This list is populated from the file /application/models/tbls/layouts.csv. Here is an example:

layout-1,Default Layout
layout-2,"Pink, Pink, Pink"
lo-3,My Favorite

Given the template conventions above, the above example layouts.csv file expects three files:

And, the drop-down for layout in the Page Editor would offer the following three options:

Template Variables
Variable Type Description
$title string title from the metadata tab
$lead string lead from the metadata tab
$etc text abstract from the metadata tab
$id unsigned page id
$slug string url slug
$cid unsigned category id
$uid unsigned user id of author
$mid unsigned media id of banner image
$flags insigned metadata flags
$layout string template filename sans path and extension
$content text contents of the content tab (after having been run through the markdown pre-processor if the markdown flag is checked)
$tail text contents of the scripts tabscripts field
$likes unsigned currently unused - eventually should be incremented via API call
$scripts csv a list of URLS from the scripts tabscripts field, which is automatically injected into the page as individual <script> tags
$yyyymmdd unsigned the $debut date formatted as YYYYMMDD
$debut UNIX date the creation date of the page, which maybe overridden on the metadata tab
$lmod UNIX date the last modified date of the page
$ip_debut IP Address IP of the original page creation post
$ip_lmod IP Address IP of the most recent page modification post
$banner filename formed by concatenating the media id and the media type of the uploaded banner image
$tag_ids csv list of all the ids of the tags assigned to the page
$cat array the page category array with keys → title, slug
$profile array the author profile with keys:
uid, flags, sketch, tagline, website, facebook, twitter, instagram, youtube, ip_debut,ip_lmod, debut,lmod, id,fullname nickname, roles
$media array the list of attached media with keys: