Example #1
0
function fetchPosts(&$categories, &$postsArray, &$postErr)
{
    foreach ($categories as $category) {
        $postsTmp = Post::getAllPostHeadersByCategoryId($category->id);
        if (count($postsTmp) > 0) {
            if (is_a($postsTmp, 'ErrorObject')) {
                $postErr[] = $postsTmp;
            } else {
                $postsArray = array_merge($postsArray, $postsTmp);
            }
        }
        if (!is_null($category->subCategories)) {
            fetchPosts($category->subCategories, $postsArray, $postErr);
        }
    }
}
Example #2
0
function getRecentPosts($pageNumber)
{
    $posts = fetchPosts($pageNumber);
    return getPostSummaries($posts, "h1");
}