Exemple #1
0
        }
    }
    return 'aprox. ' . $human_diff;
}
foreach (array_keys($comments) as $c_key) {
    $comments[$c_key]['human_time_diff'] = human_time_diff($comments[$c_key]['date_added']);
}
$item['comments']['items'] = $comments;
# Get site info (TODO: join on site table when fetching the item).
#
$site_query = "SELECT name, sane_name FROM sites WHERE id = {$item['site_id']}";
$site = $db->fetchRowQueryAssoc($site_query);
# Feed Smarty template engine with needed data
#
$smarty->assign('tpl_content', 'content-item.tpl.html');
$smarty->assign('page_style', 'style-item.css');
$smarty->assign('page_title', $item['title']);
$smarty->assign('page_description', "buzziest pic on the net - {$item['title']}");
$smarty->assign_by_ref('item', $item);
$smarty->assign_by_ref('site', $site);
# Generate the page!
#
if ($add_comment || $comment_error) {
    # if we added a comment or there was an error, clear the cache
    $smarty->clear_cache('index.tpl.html', $unique_page_name);
}
if (!$comment_error) {
    $smarty->caching = 2;
    $smarty->cache_lifetime = CACHE_TIME;
}
$smarty->display('index.tpl.html', $unique_page_name);