Simple Templating Principle

In the file single_result.tpl insert simple template code.

[php]
<li>
<a href="[+permalink+]">[+post_title+]</a>
</li>
[/php]

In the process.php insert next code

[php][/php]
// define the container’s only placeholder
//get some data and isert them into container
$container = array(‘permalind’=>’somelink’, ‘post_title’=>’sometitle’);

$single_tpl = file_get_contents( ‘single_result.tpl’);

//Place the data into template

print parse($single_tpl, $container);

function parse($tpl, $hash) {
foreach ($hash as $key => $value) {
$tpl = str_replace(‘[+'.$key.'+]‘, $value, $tpl);
}
return $tpl;
}

This is a very quick self explaned code.

/* EOF */