|
偶然在STBlog中看到这行,比如:
PHP复制代码
/**
* 获取内容列表
*
* @access public
* @param string $type 内容类型
* @param string $status 内容状态
* @param int $author_id 作者ID (optional)
* @param int $limit 条数 (optional)
* @param int $offset 偏移量 (optional)
* @param int $category_filter 需要过滤的栏目ID (optional)
* @param int $title_filter 需要过滤的标题关键字 (optional)
* @param bool $feed_filter 是否显示在feed里面 (optional)
* @return array 内容列表信息
*/
public function get_posts ($type = 'post', $status = 'publish', $author_id = NULL, $limit = NULL, $offset = NULL, $category_filter = 0, $title_filter = '', $feed_filter = FALSE)
{
$this->db->select('posts.*, users.screenName');
$this->db->join('users','users.uid = posts.authorId');
//type
if($type && in_array($type, $this->_post_type ))
{
$this->db->where('posts.type', $type);
}
//status
if($status && in_array($status,$this->_post_status ))
{
$this->db->where('posts.status', $status);
}
//author
if(!empty($author_id))
{
$this->db->where('posts.authorId', intval($author_id));
}
//category filter
if(!empty($category_filter))
{
$this->db->join('relationships','posts.pid = relationships.pid','left');
$this->db->where('relationships.mid', intval($category_filter));
}
//title filter
if(!empty($title_filter))
{
$this->db->like('posts.title', $title_filter);
}
//feed filter
if($feed_filter)
{
$this->db->where('allowFeed', 1);
}
$this->db->order_by('posts.created','DESC');
//limit
if($limit && is_numeric($limit))
{
$this->db->limit(intval($limit));
}
//offset
if($offset && is_numeric($offset))
{
$this->db->offset(intval($offset));
}
return $this->db->get(self::TBL_POSTS);
}
复制代码
怎么手册里没有 $this->db->offset() ?
|
|