update example to not be misleading with unnecessarily detailed example code

This commit is contained in:
monte.ohrt
2009-02-25 20:13:38 +00:00
parent 22ffa6944c
commit bf27d80052

View File

@@ -94,32 +94,20 @@
function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty)
{
// do database call here to fetch your template,
// populating $tpl_source
$sql = new SQL;
$sql->query("select tpl_source
from my_table
where tpl_name='$tpl_name'");
if ($sql->num_rows) {
$tpl_source = $sql->record['tpl_source'];
return true;
} else {
return false;
}
// populating $tpl_source with actual template contents
$tpl_source = "This is the template text";
// return true on success, false to generate failure notification
return true;
}
function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
{
// do database call here to populate $tpl_timestamp.
$sql = new SQL;
$sql->query("select tpl_timestamp
from my_table
where tpl_name='$tpl_name'");
if ($sql->num_rows) {
$tpl_timestamp = $sql->record['tpl_timestamp'];
return true;
} else {
return false;
}
// do database call here to populate $tpl_timestamp
// with unix epoch time value of last template modification.
// This is used to determine if recompile is necessary.
$tpl_timestamp = time(); // this example will always recompile!
// return true on success, false to generate failure notification
return true;
}
function smarty_resource_db_secure($tpl_name, &$smarty)