category_id)."&limit=none&".join("&", $params); echo "".$category->category_name." (".$category->post_count.") "; } ?> |
Archives By Month";
} else {
echo "
"; $archives = json_decode( file_get_contents($base_url."archives/?".join("&", $params)) ); foreach($archives as $archive) { $link = $_SERVER["PHP_SELF"]."?aindex=".urlencode($archive->title)."&".join("&", $params); echo "".$archive->title." (".$archive->post_count.") "; } ?> |
title == $aindex) {
$articles_link = "start_date=".$archive->start_date."&end_date=".$archive->end_date;
$archive_name = $archive->title;
$post_count = $archive->post_count;
$params[] = "aindex=".$archive_name;
}
}
} else if ($category_id != null) {
$articles_link = "category_id=".$category_id;
$params[] = "category_id=".$category_id;
foreach($categories as $category) {
if ($category->category_id == $category_id) {
$post_count = $category->post_count;
$archive_name = $category->category_name;
}
}
}
if ($articles_link != null) {
// calculate the page info
$max_pages = ceil($post_count / $page_size);
if (($page_num > $max_pages) || ($page_num < 1)) {
$page_num = 1;
}
$offset = ($page_num - 1) * $page_size;
$params[] = "offset=".$offset;
$params[] = "limit=".$page_size;
echo "
"; if ($max_pages > 1) { echo " "; } $articles = json_decode( file_get_contents($base_url."posts/?".$articles_link."&".join("&", $params)) ); foreach($articles as $article) { $link = $_SERVER["PHP_SELF"]."?post_id=".urlencode($article->post_id)."&".join("&", $params); echo "".$article->title." ".date_create($article->post_date)->format("M d, Y")." "; } } ?> |
post_date)->format("M d, Y");
echo "
".$article->title.""; echo $article->content." "; } ?> |