mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
update example to not be too misleading with unnecessarily detailed example code
This commit is contained in:
@@ -134,32 +134,20 @@ $smarty->display('file:F:/path/to/my/templates/menu.tpl');
|
||||
function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj)
|
||||
{
|
||||
// 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 db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
|
||||
{
|
||||
// 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 db_get_secure($tpl_name, &$smarty_obj)
|
||||
|
Reference in New Issue
Block a user