CoyoteCms.com

Combining the Template and Module

This section will go through how the CMS puts together a webpage using the sample template and module described in the previous two sections.

Here is our standard page template:

<html>
  <head>
    <title><? echo $this->PAGE["cms_title"]; ?></title>
  </head>
  <body>
    <? echo $this->PAGE["cms_content"]; ?>
    <p>Last Updated: <? echo $this->PAGE["Page_Updated"]; ?></p>
  </body>
</html>

Here is our articles module:

<?  $this->PAGE["cms_title"] = $this->PAGE["Article_Title"];  ?>

<h2 class="title"><? echo $this->PAGE["Article_Title"];  ?></h2>

<p>By <span class="author"><? echo $this->PAGE["Article_Author"];  ?></span></p>

<? echo $this->PAGE["Article_Text"];  ?>

And here is some sample page content from pages_Articles:

+------------+---------+---------------+---------------+
| Article_Id | Page_Id | Article_Title | Article_Aut...|
+------------+---------+---------------+---------------+
| 5 | 1 | How to... | John Smith ...|
+------------+---------+---------------+---------------+

First the module is parsed. It assigns

How to...

 to the variable $this->PAGE["cms_title"] and

<h2 class="title">How to...</h2>

<p>By <span class="author">John Smith</span></p>

<p>Some text.</p>

 to $this->PAGE["cms_content"].

Next the template is parsed. Replacing all the variables in the template code we get the final result:

<html>
  <head>
    <title>How to...</title>
  </head>
  <body>
    <h2 class="title">How to...</h2>

    <p>By <span class="author">John Smith</span></p>

    <p>Some text.</p>

    <p>Last Updated: 2005-05-05 05:05:05</p>
  </body>
</html>

Which is sent to the browser as the final page.

Demo Login
Try it out for yourself. Log in below to access the administration area. Some features (such as the Template and Module editing) are disabled. Demo Site is cleaned every hour.
Site Updates

June 13, 2006 Demo Back Online

June 7, 2006 Version 2.0 beta
New features include incremental publishing, change rejection, group-level page access and more. Visit the download page for more information.

Screen Shots
screenshots
XHTML 1.1
.net