deal gracefully with non-existent files

This commit is contained in:
Zach Prezkuta 2013-01-06 19:58:50 -07:00
parent b4a95460e6
commit c94c500cdc

View File

@ -18,18 +18,21 @@ function replace_macros($s,$r) {
$a = get_app(); $a = get_app();
if($a->get_template_engine() === 'smarty3') { if($a->get_template_engine() === 'smarty3') {
$template = ''; $output = '';
if(gettype($s) === 'string') { if(gettype($s) !== 'NULL') {
$template = $s; $template = '';
$s = new FriendicaSmarty(); if(gettype($s) === 'string') {
} $template = $s;
foreach($r as $key=>$value) { $s = new FriendicaSmarty();
if($key[0] === '$') {
$key = substr($key, 1);
} }
$s->assign($key, $value); foreach($r as $key=>$value) {
if($key[0] === '$') {
$key = substr($key, 1);
}
$s->assign($key, $value);
}
$output = $s->parsed($template);
} }
$output = $s->parsed($template);
} }
else { else {
$r = $t->replace($s,$r); $r = $t->replace($s,$r);