more PHP+jQuery posting will be added soon. :)
aMpVC PHP Framework will be Open soon.
Raymund Tech
- PHP/MySQL - jQuery - WEB 2.0
Tuesday, July 21, 2009
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]
Is this a sample for HTML_Template_IT ?
Yes, and it's easy to use.
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.
Subscribe to:
Posts (Atom)