Tuesday, July 21, 2009

More PHP jQuery

more PHP+jQuery posting will be added soon. :)

aMpVC PHP Framework will be Open soon.

PHP New Template

HTML_Template_IT

demotration on how HTML_Template_IT will separate html from php code.

file: sample.tpl

<html>

<head></head>

<body>

<!-- BEGIN test -->

Is this a sample for {engine}

<br />

{answer}

<!-- END test -->


</body>

</html>


file: sample.php

[color=red]
// include class
require ('HTML/Template/IT.php');

// create object
// set template directory
$template = new HTML_Template_IT("./");

// load template
$template->loadTemplateFile("sample.tpl");

// set block
$template->setCurrentBlock("test");

// assign values
$template->setVariable("engine", "HTML_Template_IT");
$template->setVariable("answer", "Yes, and it's easy to used.");

// parse block
$template->parseCurrentBlock();

// render page
$template->show();

?>

see output:

Is this a sample for HTML_Template_IT ?
Yes, and it's easy to use.