本文整理汇总了PHP中numofpage函数的典型用法代码示例。如果您正苦于以下问题:PHP numofpage函数的具体用法?PHP numofpage怎么用?PHP numofpage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了numofpage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getThreadsByReplies
/**
* @param $replies
* @param $order
* @param $isDesc
* @param $page
* @return unknown_type
*/
function getThreadsByReplies($replies, $page)
{
if (!$replies) {
return;
}
$sql = "SELECT p.tid FROM pw_postsfloor p GROUP BY p.tid ORDER BY p.tid DESC";
$query = $this->db->query($sql);
while ($rt = $this->db->fetch_array($query)) {
$tid[] = $rt['tid'];
}
if ($tid) {
$w_tid = " t.tid NOT IN ( " . S::sqlImplode($tid) . " ) AND ";
}
$sql = "SELECT COUNT(*) AS sum FROM pw_threads t WHERE {$w_tid} t.replies > " . S::sqlEscape($replies);
$rt = $this->db->get_one($sql);
(!is_numeric($page) || $page < 1) && ($page = 1);
$limit = S::sqlLimit(($page - 1) * $this->db_perpage, $this->db_perpage);
$result['pages'] = numofpage($rt['sum'], $page, ceil($rt['sum'] / $this->db_perpage), $this->basename . "&sub=y&action=search&replies={$replies}&");
$sql = "SELECT t.tid, t.subject, t.replies, t.postdate, t.fid\n\t\t\t\tFROM pw_threads t\n\t\t\t\tWHERE {$w_tid} t.replies > " . S::sqlEscape($replies) . " {$limit}";
$query = $this->db->query($sql);
while ($rt = $this->db->fetch_array($query)) {
list($lastDate) = PostIndexUtility::getLastDate($rt["postdate"]);
$rt["postdate"] = $lastDate;
$result['data'][] = $rt;
}
return $result;
}
示例2: pwGetPager
function pwGetPager($count, $page, $perpage, $url)
{
$page = intval($page) < 1 ? 1 : intval($page);
$perpage = $perpage ? $perpage : 20;
$numofpage = ceil($count / $perpage);
return numofpage($count, $page, $numofpage, $baseUrl);
}
示例3: execute
function execute()
{
$totalNum = $this->countPictures();
$pager = $lists = "";
if ($totalNum) {
$this->page = $this->page > 1 ? $this->page : 1;
$totalPage = ceil($totalNum / $this->perPage);
$pager = numofpage($totalNum, $this->page, $totalPage, $this->jump . "&");
$lists = $this->getBackGroundLists($this->page, $this->perPage);
}
$bool = $totalNum ? TRUE : FALSE;
return array($bool, $pager, $lists);
}
示例4: sreachPageInvokesPages
/**
* 111
*/
function sreachPageInvokesPages($array, $page, $url, $preg = 20)
{
$pageInvokeDB = $this->_getPageInvokeDB();
$page = (int) $page;
if ($page < 1) {
$page = 1;
}
$total = $pageInvokeDB->searchCount($array);
$numofpage = ceil($total / $preg);
$numofpage < 1 && ($numofpage = 1);
$page > $numofpage && ($page = $numofpage);
return numofpage($total, $page, $numofpage, $url);
}
示例5: array
pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('ifmail' => '2'));
}
if ($page == 1) {
$read['pid'] = 'tpc';
if ($foruminfo['allowhtm'] == 1) {
#纯静态页面生成
$htmurl = $db_readdir . '/' . $fid . '/' . date('ym', $read['postdate']) . '/' . $read['tid'] . '.html';
if (!$foruminfo['cms'] && !$toread && file_exists(R_P . $htmurl)) {
ObHeader("{$R_url}/{$htmurl}");
}
}
$readdb[] = $read;
}
$toread && ($urladd .= "&toread={$toread}");
$fpage > 1 && ($urladd .= "&fpage={$fpage}");
$pages = numofpage($count + $topped_count, $page, $numofpage, "read.php?tid={$tid}{$urladd}{$viewbbs}&");
$tpc_locked = $read['locked'] % 3 != 0 ? 1 : 0;
//更新帖子点击
if ($db_hits_store == 0) {
pwQuery::update('pw_threads', 'tid=:tid', array($tid), null, array(PW_EXPR => array('hits=hits+1')));
} elseif ($db_hits_store == 1) {
$db->update('UPDATE pw_hits_threads SET hits=hits+1 WHERE tid=' . S::sqlEscape($tid));
} elseif ($db_hits_store == 2) {
pwCache::writeover(D_P . 'data/bbscache/hits.txt', $tid . "\t", 'ab');
}
//帖子浏览记录
$readlog = str_replace(",{$tid},", ',', GetCookie('readlog'));
$readlog .= ($readlog ? '' : ',') . $tid . ',';
$readlogCount = substr_count($readlog, ',');
$readlogCount > 11 && ($readlog = preg_replace("/[\\d]+\\,/i", '', $readlog, $readlogCount - 11));
Cookie('readlog', $readlog);
示例6: foreach
foreach ($creditset as $key => $value) {
$moneyName = $credit->cType[$key];
$unit = $credit->cUnit[$key];
$creditPops .= $value . $unit . $moneyName . ",";
}
$deletePhotoCredit = $creditset ? '删除照片会扣除积分:' . $creditPops . '继续吗?' : '是否确认删除?';
list($album, $cnpho) = $result;
$isown = $album['ownerid'] == $winduid ? '1' : '0';
if (!$isown) {
$url = $db_bbsurl . "/apps.php?q=photos&uid=" . $album['ownerid'] . "&a=album&aid=" . $aid;
ObHeader($url);
}
$count = $album['photonum'];
$pageCount = ceil($count / $perpage);
$page = validatePage($page, $pageCount);
$pages = numofpage($count, $page, $pageCount, "{$basename}a={$a}&aid={$aid}{$friendurl}&");
$ouserdataService = L::loadClass('Ouserdata', 'sns');
/* @var $ouserdataService PW_Ouserdata */
$myOuserData = $ouserdataService->get($album['ownerid']);
$weiboPriv = false;
!$myOuserData['index_privacy'] && !$myOuserData['photos_privacy'] && !$album['private'] && ($weiboPriv = true);
} elseif ($a == 'view') {
S::gp(array('pid'));
$result = $photoService->viewPhoto($pid);
if (!is_array($result)) {
Showmsg($result);
}
// 删除积分提示
require_once R_P . 'require/credit.php';
$o_photos_creditset = unserialize($o_photos_creditset);
$creditset = getCreditset($o_photos_creditset['Deletephoto'], false);
示例7: rawurlencode
$url .= "&adminban=" . rawurlencode($adminban);
}
if ($starttime) {
!is_numeric($starttime) && ($starttime = PwStrtoTime($starttime));
$sql .= " AND b.startdate>" . pwEscape($starttime);
$url .= "&starttime={$starttime}";
}
if ($endtime) {
!is_numeric($endtime) && ($endtime = PwStrtoTime($endtime));
$sql .= " AND b.startdate<" . pwEscape($endtime);
$url .= "&endtime={$endtime}";
}
if ($count < 1) {
@extract($db->get_one("SELECT COUNT(*) AS count FROM pw_banuser b {$sql}"));
}
$pages = numofpage($rt['sum'], $page, ceil($count / $db_perpage), "{$url}&");
$bandb = $ids = $uids1 = $uids2 = array();
$query = $db->query("SELECT b.*, m.username FROM pw_banuser b LEFT JOIN pw_members m ON b.uid=m.uid {$sql} ORDER BY b.uid DESC {$limit}");
while ($rt = $db->fetch_array($query)) {
if ($rt['type'] == 1 && $timestamp - $rt['startdate'] > $rt['days'] * 86400) {
$ids[] = $rt['id'];
if ($rt['fid']) {
$uids2[] = $rt['uid'];
} else {
$uids1[] = $rt['uid'];
}
} else {
$rt['startdate'] && ($rt['date'] = get_date($rt['startdate']));
$bandb[] = $rt;
}
}
示例8: P_unlink
$rs['ifthumb'] && P_unlink("{$attachdir}/thumb/{$rs['attachurl']}");
$delnum++;
$delname .= "{$rs['attachurl']}<br>";
}
}
$db->update("DELETE FROM pw_attachs WHERE {$sql} AND aid IN({$attachs})");
}
adminmsg('attachstats_del', "{$basename}&fid={$fid}&uid={$uid}&filename=" . rawurlencode($filename) . "&hits={$hits}&ifmore={$ifmore}&filesize={$filesize}&ifless={$ifless}&orderway={$orderway}&asc={$asc}&postdate1={$postdate1}&postdate2={$postdate2}&pernum={$pernum}&page={$page}");
} elseif ($action == 'msgList') {
S::gp(array('page'), 'GP');
$messageServer = L::loadClass('message', 'message');
$attachCount = $messageServer->countAllAttachs();
$pageCount = ceil($attachCount / $db_perpage);
$page = $page < 0 || empty($page) ? 1 : ($page > $pageCount ? $pageCount : $page);
$attachList = $messageServer->getAllAttachs($page, $db_perpage);
$pages = numofpage($attachCount, $page, $pageCount, $basename . '&action=msgList&');
include PrintEot('attachment');
exit;
} elseif ($action == 'msgDel') {
S::gp(array('mids'), 'GP');
!is_array($mids) && adminmsg('请选择要删除的附件');
$messageServer = L::loadClass('message', 'message');
$messageServer->deleteAttachsByMessageIds($mids);
adminmsg('附件删除成功!', "{$basename}&action=msgList&");
}
function attachcheck($file)
{
global $cache_file, $attachdir, $admin_pwd, $filename, $filesize, $ifless, $postdate1, $postdate2, $direct, $attachdir;
if ($filename && strpos($file, $filename) === false) {
return;
}
示例9: pwLimitPages
function pwLimitPages($count, $page, $pageurl)
{
global $db_perpage, $db_maxpage;
//require_once (R_P.'require/forum.php');
$numofpage = ceil($count / $db_perpage);
$numofpage = $numofpage > $db_maxpage ? $db_maxpage : $numofpage;
$page < 1 ? $page = 1 : ($page > $numofpage ? $page = $numofpage : null);
$pages = numofpage($count, $page, $numofpage, $pageurl, $db_maxpage);
$limit = pwLimit(($page - 1) * $db_perpage, $db_perpage);
return array($pages, $limit);
}
示例10: while
$query = $db->query($sql);
while ($rt = $db->fetch_array($query)) {
$rt['date'] = get_date($rt['updated_at']);
$rt['operate'] = $operate[$rt['state']];
$record_list[] = $rt;
}
include_once PrintEot('filter');
exit;
} elseif ($job == 'post') {
$count = $db->get_value("SELECT COUNT(*) FROM pw_filter WHERE state>0 AND pid>0");
$page_count = ceil($count / $db_perpage);
if ($page > $page_count) {
$page = $page_count;
}
$limit = S::sqlLimit(($page - 1) * $db_perpage, $db_perpage);
$pages = numofpage($count, $page, $page_count, "{$basename}&action=record&job=post&");
$sql = "SELECT pf.*,pt.subject FROM pw_filter AS pf LEFT JOIN pw_threads AS pt ON pf.tid = pt.tid WHERE pf.state>0 AND pf.pid>0 ORDER BY {$sort} DESC {$limit}";
$query = $db->query($sql);
while ($rt = $db->fetch_array($query)) {
$rt['subject'] = substrs($rt['subject'], 33);
$rt['date'] = get_date($rt['updated_at']);
$rt['operate'] = $operate[$rt['state']];
$record_list[] = $rt;
}
include_once PrintEot('filter');
exit;
}
} else {
adminmsg('illegal_request');
}
} elseif ($action == 'show') {
示例11: get_date
$rt['savetime'] = $rt['savetime'] ? get_date($rt['savetime'], 'Y-m-d H:i') : '--';
if (strpos($rt['toname'], ',' . $windid . ',') !== false && $rt['msgtype'] == '2' || $groupid == '3' || $groupid == '4' || CkInArray($windid, $manager) || $rt['msgtype'] == '1' || $rt['uid'] == $winduid) {
if ($rt['uid'] != $winduid && $groupid != '3' && $groupid != '4' && CkInArray($windid, $manager) === false) {
$rt['ifuse'] = 'disabled';
} else {
$rt['ifuse'] = '';
}
$msgdb[] = $rt;
}
}
}
$db->free_result($query);
$count = $db->get_value('SELECT COUNT(*) FROM pw_forummsg WHERE fid=' . pwEscape($fid));
if ($count > $db_perpage) {
require_once R_P . 'require/forum.php';
$pages = numofpage($count, $page, ceil($count / $db_perpage), "forumcp.php?action=edit&fid={$fid}&type={$type}&");
}
if ($_POST['demsg']) {
InitGP(array('ids'));
foreach ($ids as $key => $value) {
if (is_numeric($value)) {
$iids[] = $value;
}
}
$ids = pwImplode($iids);
!$ids && Showmsg('forummsg_nodata');
$db->query("DELETE FROM pw_forummsg WHERE id IN({$ids})");
refreshto("forumcp.php?action=edit&type=msg&fid={$fid}", 'operate_success');
}
require_once PrintEot('forumcp');
footer();
示例12: exit
<?php
!defined('P_W') && exit('Forbidden');
!$db_iftag && Showmsg('tag_closed');
S::gp(array('tagname', 'page'));
$metakeyword = strip_tags($tagname);
$db_metakeyword = $metakeyword;
$subject = $metakeyword . ' - ';
$webPageTitle = $db_bbsname . '-' . $metakeyword;
require_once R_P . 'require/header.php';
//* include_once pwCache::getPath(D_P . 'data/bbscache/forum_cache.php');
pwCache::getData(D_P . 'data/bbscache/forum_cache.php');
$rs = $db->get_one('SELECT tagid,num FROM pw_tags WHERE tagname=' . S::sqlEscape($tagname));
(!is_numeric($page) || $page < 1) && ($page = 1);
$limit = S::sqlLimit(($page - 1) * $db_readperpage, $db_readperpage);
$pages = numofpage($rs['num'], $page, ceil($rs['num'] / $db_readperpage), "link.php?action=tag&tagname=" . rawurlencode($tagname) . "&");
$query = $db->query('SELECT * FROM pw_tagdata tg LEFT JOIN pw_threads t USING(tid) WHERE tg.tagid=' . S::sqlEscape($rs['tagid']) . ' order by t.lastpost desc ' . $limit);
$tiddb = array();
while ($rt = $db->fetch_array($query)) {
if ($rt['titlefont']) {
$titledetail = explode("~", $rt['titlefont']);
if ($titledetail[0]) {
$rt['subject'] = "<font color={$titledetail['0']}>{$rt['subject']}</font>";
}
if ($titledetail[1]) {
$rt['subject'] = "<b>{$rt['subject']}</b>";
}
if ($titledetail[2]) {
$rt['subject'] = "<i>{$rt['subject']}</i>";
}
if ($titledetail[3]) {
示例13: IN
$newtiddb[] = $value;
}
}
if (count($newtiddb) > 0) {
$db->update("DELETE FROM {$pcvaluetable} WHERE tid IN(" . pwImplode($newtiddb) . ") AND ifrecycle=0");
}
is_array($threadb) && ($alltids = implode(',', $threadb));
$count = $db->get_value("SELECT COUNT(tid) as count FROM {$pcvaluetable} WHERE ifrecycle=0");
}
if ($count > 0) {
$page < 1 && ($page = 1);
$numofpage = ceil($count / $db_perpage);
if ($numofpage && $page > $numofpage) {
$page = $numofpage;
}
$pages = numofpage($count, $page, $numofpage, "{$admin_file}?adminjob=postcate&action=postcate&pcid={$pcid}&newfield={$newfield}&step={$step}&");
if ($step != 'search') {
$start = ($page - 1) * $db_perpage;
$limit = pwLimit($start, $db_perpage);
}
$catedb = array();
$query = $db->query("SELECT pv.tid,t.fid,t.subject,t.author,t.authorid,t.postdate FROM {$pcvaluetable} pv LEFT JOIN pw_threads t ON pv.tid=t.tid WHERE 1 AND ifrecycle=0 {$sql} ORDER BY t.postdate DESC {$limit}");
while ($rt = $db->fetch_array($query)) {
$rt['postdate'] = get_date($rt['postdate']);
$catedb[] = $rt;
}
}
include PrintEot('postcate');
exit;
} elseif ($_POST['sendmsg'] || $action == 'sendmsg') {
InitGP(array('step', 'nexto'));
示例14: IN
$newtiddb[] = $value;
}
}
if (count($newtiddb) > 0) {
$db->update("DELETE FROM {$tablename} WHERE tid IN(" . S::sqlImplode($newtiddb) . ") AND ifrecycle=0");
}
is_array($threadb) && ($alltids = implode(',', $threadb));
$count = $db->get_value("SELECT COUNT(tid) as count FROM {$tablename} WHERE ifrecycle=0");
}
if ($count > 0) {
$page < 1 && ($page = 1);
$numofpage = ceil($count / $db_perpage);
if ($numofpage && $page > $numofpage) {
$page = $numofpage;
}
$pages = numofpage($count, $page, $numofpage, "{$admin_file}?adminjob=topiccate&action=topic&modelid={$modelid}&newfield={$newfield}&step={$step}&");
if ($step != 'search') {
$start = ($page - 1) * $db_perpage;
$limit = S::sqlLimit($start, $db_perpage);
}
$query = $db->query("SELECT tv.tid,t.fid,t.subject,t.author,t.authorid,t.postdate FROM {$tablename} tv LEFT JOIN pw_threads t ON tv.tid=t.tid WHERE 1 AND ifrecycle=0 {$sql} ORDER BY t.postdate DESC {$limit}");
while ($rt = $db->fetch_array($query)) {
$rt['postdate'] = get_date($rt['postdate']);
$topicdb[] = $rt;
}
}
include PrintEot('topiccate');
exit;
} elseif ($_POST['sendmsg'] || $action == 'sendmsg') {
S::gp(array('step', 'nexto'));
if (empty($step)) {
示例15: InitGP
InitGP(array('page', 'uid'), 'GP', 2);
$sqladd = 'WHERE 1';
if ($uid) {
$sqladd .= " AND d.uid='{$uid}'";
} elseif ($username) {
@extract($db->get_one("SELECT uid FROM pw_members WHERE username=" . pwEscape($username)));
$sqladd .= " AND d.uid=" . pwEscape($uid);
}
if ($keyword) {
$sqladd .= " AND content LIKE " . pwEscape("%{$keyword}%");
}
$db_perpage = 15;
$page < 1 && ($page = 1);
$limit = pwLimit(($page - 1) * $db_perpage, $db_perpage);
$rt = $db->get_one("SELECT COUNT(*) AS n FROM pw_draft d {$sqladd}");
$pages = numofpage($rt['n'], $page, ceil($rt['n'] / $db_perpage), "{$basename}&uid={$uid}&keyword=" . rawurlencode($keyword) . "&");
$draft = array();
$query = $db->query("SELECT d.*,m.username FROM pw_draft d LEFT JOIN pw_members m USING(uid) {$sqladd} {$limit}");
while ($rt = $db->fetch_array($query)) {
$draft[] = $rt;
}
include PrintEot('draftset');
exit;
} elseif ($action == 'del') {
if (!$_POST['step']) {
include PrintEot('draftset');
exit;
} else {
if (GetGP('clear')) {
$db->query("TRUNCATE TABLE pw_draft");
} else {