Navigation:  "The Jet Engine" PHP Application Framework > Programming Concepts > Jet Engine Objects >

iTemplate System: Overview

Previous pageReturn to chapter overviewNext page

The "V" in the "MVC" are full page layouts and sub-templates.

 

In today's world, if you're not "MVC", you're nowhere. In short, that simply means that you need to be programming with an eye on separating your layout from your logic. The iTemplate system facilitates this for you, in an extremely logical methodology.

 

Here's the process...

Design a template in full HTML

Within that template, put in some HTML comments, called "PLUGINS" that identify to your program where you want certain things to show up (such as your menu, main output, etc).

Write a program module that does your meat and potatoes work, and in the process generates some HTML (like a menu, search results, an form, etc)

Read in the template you created earlier

Replace those PLUGIN Comment tags with the HTML your program generated, where your template asks for it to show up.

 

 

Here's how a typical iTemplate enhanced program looks...

 

     <?php

     

       include_once("/path/to/iTemplate.inc.php");

       include_once("/path/to/yourprogramlibrary.inc.php");

 

       // Create a template object

       $template = new PageTemplate (

            array(

              "template_directory" => "./data/",

              "template_name" => "program.txt",

              "default" => "default.txt",

              "recursive" => ""

            )

       );

 

       // Scan for plugins

       $template->parse;

 

       // Output to the browser

       echo $template->execute;

 

       exit;

     ?>

       

   

( SERIOUSLY, THAT'S IT )

 


This help file was created with an unregistered evaluation copy of Help & Manual. © EC Software. All rights reserved. This message will not appear if you compile this help file with the registered version of Help & Manual.