function smarty_function_papyrine_getcategories($params, &$smarty)
{
    // Set default variable name.
    if (empty($params['assign'])) {
        $params['assign'] = 'categories';
    }
    $smarty->assign($params['assign'], Papyrine::Objects2Array($smarty->GetCategories()));
}
function smarty_function_papyrine_getcomments($params, &$smarty)
{
    // Set default variable name.
    if (empty($params['assign'])) {
        $params['assign'] = 'comments';
    }
    // Require an id.
    if (empty($params['entry'])) {
        $smarty->trigger_error('papyrine_getcomments: entry is a required parameter');
    }
    $entry = $smarty->GetEntry($params['entry']);
    $smarty->assign($params['assign'], Papyrine::Objects2Array($entry->GetComments()));
}
function smarty_function_papyrine_getentries($params, &$smarty)
{
    // Set default variable name.
    if (empty($params['assign'])) {
        $params['assign'] = 'entries';
    }
    if (empty($params['limit'])) {
        $params['limit'] = 10;
    }
    if (empty($params['status'])) {
        $params['status'] = 2;
    }
    if (empty($params['frontpage'])) {
        $params['frontpage'] = false;
    }
    if (empty($params['category'])) {
        $entries = $smarty->GetEntries($params['status'], $params['limit'], $params['frontpage']);
    } else {
        $category = $smarty->GetCategory($params['category']);
        $entries = $category->GetEntries($params['limit']);
    }
    $smarty->assign($params['assign'], Papyrine::Objects2Array($entries));
}