ecshop後台分頁代碼提取

來源:互聯網
上載者:User

今天做了ecshop後台分頁,於是就把分頁有用的代碼提取 出來。給大家分享下。

<?phpif($_REQUEST['act'] == ‘list’){//擷取資訊列表$pzd_list = get_pzd_list();$smarty->assign(‘pzd_list’,  $pzd_list['pzd_list']);$smarty->assign(‘filter’,       $pzd_list['filter']);$smarty->assign(‘record_count’, $pzd_list['record_count']);$smarty->assign(‘page_count’,   $pzd_list['page_count']);//後台頁面樣式$smarty->assign(‘full_page’,    1);//跳轉頁面assign_query_info();$smarty->display(‘頁面名稱.htm’);}elseif ($_REQUEST['act'] == ‘query’){//分頁代碼//擷取資訊列表$pzd_list = get_pzd_list();$smarty->assign(‘pzd_list’,  $pzd_list['pzd_list']);$smarty->assign(‘filter’,       $pzd_list['filter']);$smarty->assign(‘record_count’, $pzd_list['record_count']);$smarty->assign(‘page_count’,   $pzd_list['page_count']);//跳轉頁面make_json_result($smarty->fetch(‘snatch_list.htm’), ”,array(‘filter’ => $pzd_list['filter'], ‘page_count’ => $pzd_list['page_count']));}//查詢資料方法function get_pzd_list(){$sql = “SELECT COUNT(*) FROM ” . $GLOBALS['ecs']->table(‘cuanji’);$filter['record_count'] = $GLOBALS['db']->getOne($sql);$filter = page_and_size($filter);/* 獲活動資料 */$sql = “SELECT * FROM ” . $GLOBALS['ecs']->table(‘cuanji’).” LIMIT “. $filter['start'] .”, ” . $filter['page_size'];$filter['keywords'] = stripslashes($filter['keywords']);set_filter($filter, $sql);$row = $GLOBALS['db']->getAll($sql);$arr = array(‘pzd_list’ => $row, ‘filter’ => $filter, ‘page_count’ => $filter['page_count'], ‘record_count’ => $filter['record_count']);return $arr;}?>

<!—————————————————html代碼———————————————-><!–匯入js–>{insert_scripts files=”../js/utils.js,listtable.js”}<!–動態賦值div 名字必須相同–><div  id=”listDiv”><!–迴圈顯示相關資訊–></div><!–分頁樣式–>{include file=”page.htm”}<script>//分頁js賦值listTable.recordCount = {$record_count};listTable.pageCount = {$page_count};{foreach from=$filter item=item key=key}listTable.filter.{$key} = ‘{$item}’;{/foreach}</script>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.