Agile Toolkit  4.2
Agile Toolkit is a powerful web development framework. Inspired by GUI Applications development
SMlite Class Reference
Inheritance diagram for SMlite:
AbstractModel AbstractObject

Public Member Functions

 getTagVal ($tag)
 getDefaultSettings ()
 init ()
 __clone ()
 cloneRegion ($tag)
 dumpTags ()
 get ($tag)
 appendHTML ($tag, $value)
 append ($tag, $value, $encode=true)
 setHTML ($tag, $value=null)
 set ($tag, $value=null, $encode=true)
 hasTag ($tag)
 is_set ($tag)
 trySetHTML ($tag, $value=null)
 trySet ($tag, $value=null, $encode=true)
 del ($tag)
 tryDel ($tag)
 eachTag ($tag, $callable)
 findTemplate ($template_name)
 loadTemplateFromString ($template_string)
 loadTemplate ($template_name, $ext=null)
 parseTemplate (&$template, $level=0, $pc=0)
 registerTag ($key, $npk, &$ref)
 isTopTag ($tag)
 rebuildTags ()
 rebuildTagsRegion (&$branch)
 render ()
 renderRegion (&$chunk)
 myStrTok (&$string, $tok)

Data Fields

 $tags = array()
 $top_tag = null
 $template = array()
 $settings = array()
 $template_type = 'template'
 $updated_tag_list = array()

Detailed Description

==[ About SMlite ]========================================================== This class is a lightweight template engine. It's based around operating with chunks of HTML code and the main aims are:

  • completely remove any code from templates
  • make templates editable with HTML editor
Author:
Romans <romans@adevel.com>
Version:
1.1 php5 (perhaps php4 untested)

==[ Version History ]======================================================= 1.0 First public version (released with AModules3 alpha) 1.1 Added support for "_top" tag Removed support for permanent tags Much more comments and other fixes

==[ Description ]=========================================================== SMlite templates are HTML pages containing tags to mark certain regions. <html><head> <title>MySite.com - <?page_name?>unknown page<?/page_name?></title> </head>

Inside your application regions may be manipulated in a few ways:

  • you can replace region with other content. Using this you can replace name of sub-page or put a date on your template.
  • you can clone whole template or part of it. This is useful if you are working with objects
  • you can manipulate with regions from different files.

Traditional recipe to work with lists in our templates are:

1. clone template of generic line 2. delete content of the list 3. inside loop 3a. insert values into cloned template 3b. render cloned template 3c. insert rendered HTML into list template 4. render list template

Inside the code I use terms 'region' and 'spot'. They refer to the same thing, but I use 'spot' to refer to a location inside template (such as <?$date?>), however I use 'region' when I am refering to a chunk of HTML code or sub-template. Sometimes I also use term 'tag' which is like a pointer to region or spot.

When template is loaded it's parsed and converted into array. It's possible to cache parsed template serialized inside array.

Tag name looks like this:

"misc/listings:student_list"

Which means to seek tag <?student_list?> inside misc/listings.html

You may have same tag several times inside template. For example you can use tag <?$title?> inside <head><title> and

. If you would set('title','My Title'); it will insert that value in all those regions. ==[ AModules3 integration ]================================================= Rule of thumb in object oriented programming is data / code separation. In our case HTML is data and our PHP files are code. SMlite helps to completely cut out the code from templates (smarty promotes idea about integrating logic inside templates and I decided not to use it for that reason) Inside AModules3, each object have it's own template or may have even several templates. When object is created, it's assigned to region inside template. Later object operates with assigned template. Each object is also assigned to a spot on their parent's template. When object is rendered, it's HTML is inserted into parent's template. ==[ Non-AModules3 integration ]============================================= SMlite have no strict bindings or requirements for AModules3. You are free to use it inside any other library as long as you follow license agreements.


Member Function Documentation

__clone ( )

Reimplemented from AbstractObject.

append ( tag,
value,
encode = true 
)
appendHTML ( tag,
value 
)
cloneRegion ( tag)
del ( tag)
dumpTags ( )
eachTag ( tag,
callable 
)
findTemplate ( template_name)
get ( tag)
getTagVal ( tag)
hasTag ( tag)

Check if tag is present inside template

init ( )

Initialize object. Always call parent

This method is called for initialization

Reimplemented from AbstractObject.

is_set ( tag)
isTopTag ( tag)
loadTemplate ( template_name,
ext = null 
)
loadTemplateFromString ( template_string)
myStrTok ( &$  string,
tok 
)
parseTemplate ( &$  template,
level = 0,
pc = 0 
)
rebuildTagsRegion ( &$  branch)
registerTag ( key,
npk,
&$  ref 
)
render ( )
renderRegion ( &$  chunk)
set ( tag,
value = null,
encode = true 
)
setHTML ( tag,
value = null 
)
tryDel ( tag)
trySet ( tag,
value = null,
encode = true 
)
trySetHTML ( tag,
value = null 
)

Field Documentation

$settings = array()

Reimplemented from AbstractObject.

$tags = array()
$template = array()
$template_type = 'template'

Type of resource to look for pathFinder

$top_tag = null
$updated_tag_list = array()

list of updated tags with values


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations