public function next_post_link($post) { $next_link = ''; $next_post= false; DB::set_fetch_mode( PDO::FETCH_CLASS ); DB::set_fetch_class( 'Post' ); $next_post= DB::get_row( 'select * from {posts} where content_type = ? and status = ? and pubdate > ? order by pubdate asc', array(Post::type('entry'), Post::status('published'), $post->pubdate), 'Post' ); if( ( $next_post ) != false ) { $next_link= '' . $next_post->title . ' »'; } return $next_link; } public function prev_post_link($post) { $prev_link = ''; $prev_post= false; DB::set_fetch_mode( PDO::FETCH_CLASS ); DB::set_fetch_class( 'Post' ); $prev_post= DB::get_row( 'select * from {posts} where content_type = ? and status = ? and pubdate < ? order by pubdate desc', array(Post::type('entry'), Post::status('published'), $post->pubdate), 'Post' ); if( ( $prev_post ) != false ) { $prev_link= '' . '« ' .$prev_post->title . ''; } return $prev_link; }