How to make a template

Of course, now that you have a CMS running on your server you'll want to make a template so that the pages actually look like a part of your site.  The following example will show you how to get started making a template for your site.

Step 1: Design your page

 

We all have our different methods.  Mine is to draw page sketches in pencil. Others might jump straight into photoshop.  Whatever works for you.  Just keep in mind what page elements you need to design for:

  • At least one menu
  • The page body
  • Optional Breadcrumbs

Step 2: Create an HTML page

 

Once you have your design created, make an HTML page that employs that design.  When you're making the page and stylesheet you can use the following excerpts in place of elements generated by simple:

Menus:

<ul>
  <li><a href="#">Menu Item</a></li>
  <li><a href="#">Menu Item</a>
    <ul>
      <li><a href="#">Sub-menu Item</a></li>
    </ul>
  </li>
</ul>

Breadcrumbs:

<div class="simple-breadcrumbs">
  <a href="#">Site Root</a> &gt;
  <a href="#">Level 1</a> &gt;
  <a href="#">Level 2</a>
</div>

Step 3: Prepare the page to become a template

 

After you have a page created that looks the way you want, you'll need to place it in a folder somewhere in the simple templates directory.  Once the page is there with its supporting files make sure to give it a PHP extension and alter any references to supporting files (such as CSS files or images) so that they use root-relative URLs.

Replace the menu, breadcrumb, title, and body objects with the appropriate controls.

Top of the page

  • GeneratePageControls - this must be placed after the BODY tag in your template for the template to be usable.

Menu

Breadcrumbs

Page Title

  • <!-- SIMPLE PageTitle -->

Page Body

  • <!-- SIMPLE PageBody -->

Step 4: Add the template to the CMS

 

Login to simple's management console and go to the "templates" tab.  Click to add a template, then set the name and file name.  Remember that the file location is assumed to be within the /templates folder.

Step 5: Start making pages

 

Once the template is functioning you can start making pages using it for layout.

Results: