//phpinfo();
function print_array($a, $prefix = '') {
foreach ($a as $k => $v) {
echo $prefix . htmlspecialchars("[$k] => [$v]") . "
";
if (is_array($v)) {
print_array($v, "$prefix-------- ");
}
}
}
include_once("../ObjTemplate.class.php");
$tmpl = new ObjTemplate("test2.tmpl");
echo "
template array print
";
$a = $tmpl->get_array();
print_array($a);
echo "
is_key() test
";
print 'is_key("subtemplate"): ' . ($tmpl->is_key("subtemplate") == true ? "true" : "false");
print "
";
print 'is_key("level2"): ' . ($tmpl->is_key("level2") == true ? "true" : "false");
print "
";
echo "
get_keys() test
";
$a = $tmpl->get_keys();
print_array($a);
echo "
add_before(), add_after() and set() test
";
$tmpl->add_before("BEFORE");
$tmpl->add_after("AFTER");
$tmpl->set(array(
"xxx" => "KOFOLAAAAAA",
'yyy' => 'PIVO!',
'level' => '3',
'level2' => 14,
'level:no2' => 14,
'subtemplate' => "aaa%subtemplatex%aa",
'subtemplatex' => "XXXXXXXXXX"
));
echo "
template array print
";
$a = $tmpl->get_array();
print_array($a);
echo "
get_keys() test II.
";
echo "NOTE: this is after substitution, so the array will not contain substituted keys";
$a = $tmpl->get_keys();
print_array($a);
echo "
clean() test
";
echo $tmpl->clean();
echo "
hide() test
";
echo $tmpl->hide();
echo "
html() test
";
echo $tmpl->html();
echo "
html_array('include') test
";
$a = $tmpl->html_array('include');
print_array($a);
?>