本文整理匯總了PHP中Page::limit方法的典型用法代碼示例。如果您正苦於以下問題:PHP Page::limit方法的具體用法?PHP Page::limit怎麽用?PHP Page::limit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Page
的用法示例。
在下文中一共展示了Page::limit方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
/**
* 評論列表
*/
public function index()
{
if (!isset($this->category[$this->cid])) {
$this->error('欄目不存在');
}
if (empty($this->aid)) {
$this->error('文章不存在');
}
$category = S('category');
$model = S('model');
$contentData = M($model[$category[$this->cid]['mid']]['table_name'])->find($this->aid);
if (empty($contentData)) {
$this->error('文章不存在', __ROOT__);
}
$db = M('addon_comment');
$map['cid'] = array('EQ', $this->cid);
$map['aid'] = array('EQ', $this->aid);
$count = $db->where($map)->count();
$page = new Page($count, 10);
$data = M('addon_comment')->field('c.comment_id,c.user_id,icon,username,comment_content,comment_time,praise,cid,aid,status,count(r.reply_id) AS reply_count')->join('__user__ u JOIN __addon_comment__ c ON u.uid=c.user_id LEFT JOIN __addon_comment_reply__ r ON c.comment_id=r.comment_id')->group('c.comment_id')->where($map)->limit($page->limit())->all();
//回複數據
foreach ($data as $id => $d) {
$data[$id]['reply'] = M('addon_comment_reply')->join("__addon_comment_reply__ a JOIN __user__ u ON a.user_id=u.uid")->where("comment_id={$d['comment_id']}")->all();
}
$this->assign('data', $data);
$this->assign('count', $count);
$this->assign('page', $page);
$this->display();
exit;
}
示例2: index
public function index()
{
$u = preg_replace('@[^\\w]@', '', Q('u'));
$pre = C('DB_PREFIX');
$sql = "SELECT uid,nickname,rname,r.rid,spec_num,credits,regtime,logintime,domain,icon FROM {$pre}user AS u\n INNER JOIN {$pre}role AS r ON u.rid=r.rid\n WHERE u.uid='{$u}' OR domain='{$u}'";
if (!($user = M()->query($sql))) {
_404('會員不存在');
}
$user = $user[0];
//--------------------------增加空間訪問次數
if (!isset($_SESSION['uid']) or $_SESSION['uid'] != $user['uid']) {
$sql = "UPDATE {$pre}user SET spec_num=spec_num+1";
M()->exe($sql);
}
//---------------------------獲得文章列表
$where = 'uid=' . $user['uid'] . ' AND content_state=1 ';
$db = M('content');
$count = $db->where($where)->count();
$page = new Page($count, 10);
$data = $db->where($where)->limit($page->limit())->all();
$this->data = $data;
$this->page = $page->show();
$this->user = $user;
//------------------------------獲得訪問數據
$guest = $this->getGuest($user['uid']);
$this->assign('guest', $guest);
$this->display();
}
示例3: index
public function index()
{
$page = new Page($this->_db->count(), 15);
$this->data = $this->_db->limit($page->limit())->order("total DESC")->all();
$this->page = $page->show();
$this->display();
}
示例4: show
public function show()
{
$cid = Q('cid', 0, 'intval');
$aid = Q('aid', 0, 'intval');
$Model = K('Comment');
$where = "comment_state=1 AND cid={$cid} AND aid={$aid}";
$count = $Model->join()->where($where)->where("pid=0 ")->count();
$page = new Page($count, 15);
$data = array();
if ($count) {
//獲得1級回複的id
$result = $Model->where($where)->where("pid=0 ")->limit($page->limit())->order("comment_id desc")->getField('comment_id', true);
$comment_id = implode(',', $result);
$data = $Model->where("comment_state=1 AND (comment_id IN ({$comment_id}) OR reply_comment_id IN ({$comment_id}))")->order("comment_id ASC")->all();
//設置頭像(沒有頭像的用戶使用默認頭像)
foreach ($data as $n => $d) {
if (empty($d['icon'])) {
$data[$n]['icon'] = __ROOT__ . "/data/image/user/50-gray.png";
} else {
$data[$n]['icon'] = __ROOT__ . '/' . $d['icon'];
}
}
}
//獲得多層
$data = Data::channelLevel($data, 0, '', 'comment_id');
$this->assign('page', $page->show());
$this->assign('data', $data);
$con = $this->fetch('index.php');
if (Q('page')) {
echo $con;
} else {
echo "document.write('<div id=\"hdcomment\">" . preg_replace('@\\r|\\n@mi', '', addslashes($con)) . "</div>')";
}
exit;
}
示例5: index
/**
* 查看訂單
* @return [type] [description]
*/
public function index()
{
$page = new Page($this->db->count(), 5);
$data = $this->db->limit($page->limit())->all();
$this->assign(array('data' => $data, 'page' => $page->show()));
$this->display();
}
示例6: doWebLists
public function doWebLists()
{
$Model = new CreditsRecord();
//會員信息
$user = Db::table('member')->where('uid', Session::get('member.uid'))->first();
if ($timerange = q('get.timerange')) {
//有篩選時間的
$timerange = explode('至', $timerange);
$total = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->where('createtime', '>=', strtotime($timerange[0]))->where('createtime', '<=', strtotime($timerange[1]))->count();
$page = Page::row(8)->make($total);
$data = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->where('createtime', '>=', strtotime($timerange[0]))->where('createtime', '<=', strtotime($timerange[1]))->limit(Page::limit())->get();
} else {
$total = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->count();
$page = Page::row(8)->make($total);
$data = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->limit(Page::limit())->get();
}
//收入
$income = $Model->where('num', '>', 0)->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->sum('num');
//支出
$expend = $Model->where('num', '<', 0)->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->sum('num');
View::with(['income' => $income, 'expend' => $expend]);
View::with('page', $page);
View::with('user', $user);
View::with('data', $data);
View::make($this->ucenter_template . '/credit_lists.html');
}
示例7: index
public function index()
{
$page = new Page($this->_db->count(), 10);
$this->page = $page->show(2);
$this->article = $this->_db->limit($page->limit())->all();
$this->display();
}
示例8: index
public function index(){
$total = $this->db->totalPro();
$page = new Page($total,2,2);
$data = $this->db->allPro($page->limit());
$this->assign('page',$page->show());
$this->assign('goods',$data);
$this->display();
}
示例9: getFavoritesAricle
public function getFavoritesAricle()
{
$db = M('favorite');
$where = "user_id=" . $_SESSION['user']['uid'];
$page = new Page($db->where($where)->count(), 6);
$data = $db->where($where)->limit($page->limit())->order('fid DESC')->all();
return array('data' => $data, 'page' => $page->show());
}
示例10: index
/**
* 顯示列表
*/
public function index()
{
$count = $this->db->count();
$page = new Page($count);
$this->page = $page->show();
$upload = $this->db->order("id desc")->limit($page->limit())->all();
$this->assign('upload', $upload);
$this->display();
}
示例11: index
public function index()
{
$db = K('Comment');
$page = new Page($db->count(), 10);
$data = $db->limit($page->limit())->all();
$this->assign('data', $data);
$this->assign('page', $page->show());
$this->display();
}
示例12: index
public function index()
{
$ContentModel = ContentViewModel::getInstance($this->_mid);
$where = "uid=" . $_SESSION['uid'];
$page = new Page($ContentModel->join('category')->where($where)->count(), 15);
$data = $ContentModel->join('category')->where($where)->limit($page->limit())->order(array("arc_sort" => "ASC", 'aid' => "DESC"))->all();
$this->assign('data', $data);
$this->display();
}
示例13: index
public function index()
{
$count = $this->db->count();
$page = new Page($count, 10);
$data = $this->db->limit($page->limit())->order("comment_id DESC")->all();
$this->assign('data', $data);
$this->assign('page', $page->show());
$this->display();
}
示例14: search
public function search()
{
$word = Q('word');
if (!$word) {
$this->error("搜索內容不能為空");
} else {
$cid = Q('cid', 0, 'intval');
$mid = $cid ? $modelCache[$categoryCache[$cid]['mid']] : 1;
$pre = C('DB_PREFIX');
$seachType = Q('type', 'title');
$modelCache = cache('model');
$categoryCache = cache('category');
$contentModel = ContentViewModel::getInstance($mid);
$table = $modelCache[$mid]['table_name'];
if ($seachType == 'tag') {
$db = M();
$countSql = "SELECT count(*) AS c FROM \n\t\t\t\t\t\t(SELECT distinct(aid) FROM {$pre}tag AS t INNER JOIN {$pre}content_tag AS ct ON t.tid=ct.tid WHERE tag='{$word}' AND mid=1 GROUP BY aid) AS c";
$count = $db->query($countSql);
$page = new Page($count[0]['c'], 15);
$DataSql = "SELECT * FROM {$pre}category as cat JOIN {$pre}{$table} AS c ON cat.cid = c.cid JOIN {$pre}content_tag AS ct ON c.aid=ct.aid INNER \n\t\t\t\t\t\t\t\t\t\tJOIN {$pre}tag AS t ON t.tid=ct.tid WHERE t.tag='{$word}' LIMIT " . $page->limit(true);
$data = $db->query($DataSql);
} else {
$where = array();
if ($cid) {
$where[] = $pre . "category.cid=" . $cid;
}
if (!empty($_GET['search_begin_time']) && !empty($_GET['search_end_time'])) {
$where[] = "addtime>=" . strtotime($_GET['search_begin_time']) . " AND addtime<=" . $_GET['search_end_time'];
}
switch ($seachType) {
case 'title':
$where[] = "title like '%{$word}%'";
$count = $contentModel->join('category')->where($where)->count();
$page = new Page($count, 15);
$data = $contentModel->join('category')->where($where)->all();
break;
case 'description':
$where[] = "description like '%{$word}%'";
$count = $contentModel->join('category')->where($where)->count();
$page = new Page($count, 15);
$data = $contentModel->join('category')->where($where)->all();
break;
case 'username':
$where[] = "username like '%{$word}%'";
$count = $contentModel->join('category,user')->where($where)->count();
$page = new Page($count, 15);
$data = $contentModel->join('category,user')->where($where)->all();
break;
}
}
$this->assign('searchCategory', $categoryCache);
$this->assign('page', $page);
$this->assign('data', $data);
$this->display();
}
}
示例15: friend
/**
* 好友動態
*/
public function friend()
{
$db = V('user_dynamic');
$db->view = array('user' => array('type' => INNER_JOIN, 'on' => 'user_dynamic.uid=user.uid'), 'user_follow' => array('type' => INNER_JOIN, 'on' => 'user_follow.uid=user_dynamic.uid'));
$count = $db->where('fans_uid=' . $_SESSION['uid'])->count();
$page = new Page($count, 9);
$this->page = $page->show();
$this->data = $db->where('fans_uid=' . $_SESSION['uid'])->limit($page->limit())->order("did DESC")->all();
$this->display();
}