<?php
if($_REQUEST['act'] == 'list'){
//獲取信息列表
$order_list = order_list();
$smarty->assign('order_list', $order_list['order_list']);
$smarty->assign('filter', $order_list['filter']);
$smarty->assign('record_count', $order_list['record_count']);
$smarty->assign('page_count', $order_list['page_count']);
//后臺頁面樣式
$smarty->assign('full_page', 1);
//跳轉(zhuǎn)頁面
assign_query_info();
$smarty->display('order_list.htm');
}
elseif ($_REQUEST['act'] == 'query'){//分頁代碼
//獲取信息列表
$order_list = order_list();
$smarty->assign('order_list', $order_list['order_list']);
$smarty->assign('filter', $order_list['filter']);
$smarty->assign('record_count', $order_list['record_count']);
$smarty->assign('page_count', $order_list['page_count']);
//跳轉(zhuǎn)頁面
make_json_result ( $smarty->fetch ( 'order_list.htm' ), '', array ('filter' => $order_list ['filter'], 'page_count' => $order_list ['page_count'] ) );
}
//查詢數(shù)據(jù)方法
function order_list()
{
$sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('cuanji');
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
/* 獲活動數(shù)據(jù) */
$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('order_list' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
?>
<!—————————————————html代碼———————————————->
<!–導(dǎo)入js–>
{insert_scripts files='../js/utils.js,listtable.js'}
<!–動態(tài)賦值div 名字必須相同–>
<div id='listDiv'>
<!–循環(huán)顯示相關(guān)信息–>
</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>
發(fā)表評論