Methods
php | tpleng ( [string $root [, string $empty]] ) |
root ( default: './' ) - root directory of templates empty ( default: 'empty' ) - defines how uknown handles should be replaced if not declared 'empty' - remove |
php | Template Engine initialization |
require_once('./tpleng.class.php');
|
php | set_file ( string $var_name, string $file_name ) |
var_name - var's handle which should be assigned to file_name - file name |
php | main template file |
sets main template file |
php | files only with blocks |
sets file with blocks. If the file contains only block those files may be assigned on the same handle. |
php | set_var ( string $var_name, string $var_value ) |
var_name - var's handle which should be assigned to var_value - handle's value |
php | simple handle |
assign simple handle |
html | simple handle |
handles must be written between braceleft ('{') and braceright ('}') |
php | handle-array |
data could be array as well
|
html | handle-array |
handle-array's must be declared the same as simple handles but handle and subhandle should be separated with dot. |
php | ifset tag |
first example
second example
|
html | ifset tag |
you may use the first example's result: second example's result:
|
php | set_loop ( string $loop_name, array $loop_value ) |
loop_name - loop's handle which should be assigned to loop_value - loop's values |
php | simple loop |
$loop
= array( |
html | simple loop |
loop should be declared between
|
php | loop and ifset tag |
$loop
= array( |
html | loop and ifset tag |
will be generated list where people (who have emails) names' will be links to email them and there won't be empty links |
php | set_rotation ( string $loop_name, string $rot_name, array $rot_value ) |
loop_name - name of loop in which rotation is active rot_name - rotation handle in loop rot_value - rotation values |
php | rotation in loop |
for example if you need to make table where rows should be different
color. |
html | rotation in loop |
every other row will be light grey. |
php | set_block ( string $var_name, string $block_name [, string $append] ) |
var_name - handle which should be assigned to block_name - handle of the block which content should be assigned append ( default: false ) - if value is true, then content of the block will be append to handle else content will be assign. |
php | simple block |
$tpleng->set_file('blocks',
'bloks.htm');
|
html | simple block (blocks.htm) |
result: boo |
php | parse ( string $var_name [, string $output [, string $file_name]] ) |
var_name - handle which should be parsed output ( default: 'echo' ) - output destination 'echo' - echo text file_name ( default: 'output.htm' ) - file name where content should be written. It is active only if output is set to 'file' |
php | parsing into file |
Simply prints content of the handle called 'main' $tpleng->parse('main'); |