The template class

The template class is a simple system to replace placeholders with content.
The tempate-file can be a container  for Text, HTML, XML or something else.

The SKOR Template class has no  logic implemented and never will. It is not the  goal of this project  to put  business Logic  or whatever-logic into a template system. It will just help you to write clean PHP - Code.

The interface simply consists of 4 methods:

function read()
function assign()
function display()
function get_content()

and 3 attributes:



The function read() expects no argument...
 it will read in your template-file and parse it.

The function assign() expects 2 arguments ...
The first argmunt must be a string and must be identical (without curly brackets) to a single placeholder  in the template-file.
The second argument must be a string and should contain some content you want to replace the placeholder with.

The function display() expects no argument...
and simply will display the content after the replacement was done.

The function get_content() expects no argument...
it will just return the content after the replacement was done .. so you can do something else with.

The attribute $dir must be a string containing a valid path to a directory with you templates in...
it must hav a trailing slash.

The attribute $html must be a string containing a filename.

The attribute $keep_unassigned must be a boolean (true / false)
if true you will see placeholders in the output not yet assigned.
if false all unassigned placeholders will be replaced with an empty string.

Quick Box