Browse Source

Fix RSS bugs.

Fix RSS bugs due to code changes.
pull/4/merge
Danang Probo Sayekti 12 years ago
parent
commit
785f07c907
2 changed files with 8 additions and 6 deletions
  1. +1
    -4
      system/htmly.php
  2. +7
    -2
      system/includes/functions.php

+ 1
- 4
system/htmly.php View File

@ -19,10 +19,7 @@ get('/index', function () {
$page = $page ? (int)$page : 1; $page = $page ? (int)$page : 1;
$perpage = config('posts.perpage'); $perpage = config('posts.perpage');
$posts = get_posts($page);
// Extract a specific page with results
$posts = array_slice($posts, ($page-1) * $perpage, $perpage);
$posts = get_posts($page, $perpage);
$total = ''; $total = '';


+ 7
- 2
system/includes/functions.php View File

@ -18,7 +18,7 @@ function get_post_names(){
// Get the names of all the // Get the names of all the
// posts (newest first): // posts (newest first):
$_cache = array_reverse(glob('content/*/blog/*.md', GLOB_NOSORT));
$_cache = glob('content/*/blog/*.md', GLOB_NOSORT);
} }
return $_cache; return $_cache;
@ -56,6 +56,7 @@ function get_author_names(){
return $_cache; return $_cache;
} }
// usort function. Sort by date.
function cmp($a, $b) { function cmp($a, $b) {
return $a->date == $b->date ? 0 : ( $a->date < $b->date ) ? 1 : -1; return $a->date == $b->date ? 0 : ( $a->date < $b->date ) ? 1 : -1;
} }
@ -115,6 +116,10 @@ function get_posts($page = 1, $perpage = 0){
} }
usort($tmp,'cmp'); usort($tmp,'cmp');
// Extract a specific page with results
$tmp = array_slice($tmp, ($page-1) * $perpage, $perpage);
return $tmp; return $tmp;
} }
@ -372,7 +377,7 @@ function tag_cloud() {
echo '<h3>Tags</h3>'; echo '<h3>Tags</h3>';
echo '<ul class="taglist">'; echo '<ul class="taglist">';
foreach ($tag_collection as $tag => $count){ foreach ($tag_collection as $tag => $count){
echo '<li class="item"><a href="' . site_url() . 'tag/' . $tag . '">' . $tag . '</a> <span class="count">(' . $count . ')</span></li>';
echo '<li class="item"><a href="' . site_url() . 'tag/' . $tag . '">' . ucfirst($tag) . '</a> <span class="count">(' . $count . ')</span></li>';
} }
echo '</ul>'; echo '</ul>';


Loading…
Cancel
Save