示例#1
0
文件: Archive.php 项目: kminkov/Blog
 public function archive()
 {
     $mapper = new Model_Mapper_Cache_Post();
     $years = $mapper->fetchValidYears();
     $string = '';
     for ($year = $years['min_year']; $year <= $years['max_year']; $year++) {
         $string .= '<li><a title="' . $year . '" href="/blog/archive/' . $year . '/">' . $year . '</a></li>';
     }
     return $string;
 }
示例#2
0
 public function recentBlogs($limit = 2)
 {
     $mapper = new Model_Mapper_Cache_Post();
     $posts = $mapper->getRecentPosts($limit);
     $string = '';
     foreach ($posts as $post) {
         $string .= '<li><a title="' . $post->title . '" href="/blog/view/' . urlencode($post->category->name) . '/' . urlencode($post->title) . '/">' . $post->title . '</a></li>';
     }
     return $string;
 }