Home  >  Article  >  php教程  >  Change the paging mode based on the original

Change the paging mode based on the original

WBOY
WBOYOriginal
2016-08-04 08:56:191051browse

My system is an audio website, and all audio data is written in one field. If there are thousands of pieces! Without pagination, the website will basically freeze when you open it. Share the front-end and back-end code with everyone, hope you can learn the functions
后台代码//分页开始<br>         $rs = M('Vod');<br>         $user = array();<br>         $user['q_islock'] = $_REQUEST['q_islock'];<br>         $selectType = $_REQUEST['q_selectType'];<br>         $wd = urldecode(trim($_REQUEST['wd']));<br>         $user['selectType'] = $selectType;<br>         $user['wd'] = $wd;<br>         $user['p'] = '';<br> <br>         if ($user['q_islock'] == 1) {<br>             $where['islock'] = array('eq', 1);<br>         }<br>         else if ($user['q_islock'] == 2) {<br>             $where['islock'] = array('eq', 0);<br>         }<br> <br>         if (!empty($selectType) && !empty($wd)) {<br>             $where[$selectType] = array('like', '%' . $wd . '%');<br>         }<br>         $ida=$_GET['id'];<br>         $vod_url=$rs->where("vod_id=$ida")->getfield("vod_url");<br>         $count=(substr_count($vod_url,"$")-3)/2;<br>         $limit = C('url_num_admin');<br>         $totalpages = ceil($count / $limit);<br>         $currentpage = (!empty($_GET['p']) ? intval($_GET['p']) : 1);<br>         $currentpage = get_maxpage($currentpage, $totalpages);<br>         $pageurl = U('/read-id-'.$ida, $user, false, false) . '{!page!}' . C('url_html_suffix');<br>         $user['p'] = $currentpage;<br>         $_SESSION['user_jumpurl'] = U('/read-id-'.$ida, $user) . C('url_html_suffix');<br>         $page = '共' . $count . '个 当前:' . $currentpage . '/' . $totalpages . '页 ' . getpage($currentpage, $totalpages, 3, $pageurl, 'pagego('' . $pageurl . '',' . $totalpages . ')');<br>         $user['page'] = $page;<br>         $f['currentpage']=$currentpage;<br>         $sq['vod_id']=$ida;<br>         $vod_playlist=$rs->find($ida);<br>         $this->assign($f);<br>         $this->assign($user);<br>         //分页结束模板代码块<php>$fj=($currentpage-1)*20</php><br>                 <volist name="gxlcms_playlist" id="gxlcms"> <br> <if condition="$gxlcms.playname eq ts"><br>         <fflist name="gxlcms['son']" id="gxlcmsson" order="asc" offset="$fj" length='20'><br> <br>                    <li  ><time>更新时间:{$vod_addtime|date='Y-m-d H:i:s',###}</time><i class="icon-play-d"></i><a  href="{$gxlcmsson.playurl}">{$gxlcmsson.playname}</a></li><br>                     </fflist><br>                       <br>                 </if> </volist>Change the paging mode based on the original

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:TP5 AuthNext article:TP5 Auth