ecshop中自定义页面的分页实现使用ecs自带分页程序
2016-02-16 15:50
495 查看
/*------------------------------------------------------ */
//-- 商铺服务列表
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list')
{
/* 检查权限 */
admin_priv('shop_service');
//包含分页方法
$sql = "SELECT COUNT(*) FROM " . $ecs->table('shop_service') . " where status=1";
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
$sql = "SELECT a.id as service_id,a.user_id,a.option_id,a.service_name,a.market_price,a.promote_price,a.list_page_img,from_unixtime(a.create_time) as create_time,a.service_count,a.type,b.shop_mobile_phone,b.truename,c.option_name,d.type_name,e.img_url as
list_page_img FROM ".$ecs->table('shop_service')." as a left join ecs_business_service_join as b on a.user_id=b.user_id left join ecs_service_option as c on a.option_id=c.id left join ecs_join_shop_type as d on b.shop_type=d.id left join ecs_user_pic as e
on a.list_page_img=e.id where a.status=1 order by a.create_time LIMIT " . $filter['start'] . ',' . $filter['page_size'];
set_filter($filter, $sql);
$rs = $GLOBALS['db']->getAll($sql);
foreach($rs as $k=>$v){
if($v['list_page_img'] != ''){
$rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . $v['list_page_img'];
}else{
$rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . 'default.png';
}
}
$lists = array('shop_service_list' => $rs, 'filter' => $filter,
'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
$smarty->assign('shop_service_list', $lists['shop_service_list']);
$smarty->assign('filter', $lists['filter']);
$smarty->assign('record_count', $lists['record_count']);
$smarty->assign('page_count', $lists['page_count']);
$smarty->assign('full_page', 1);
$smarty->display('shop_service_list.htm');
}
elseif ($_REQUEST['act'] == 'query'){
$sql = "SELECT COUNT(*) FROM " . $ecs->table('shop_service') . " where status=1";
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
$sql = "SELECT a.id as service_id,a.user_id,a.option_id,a.service_name,a.market_price,a.promote_price,a.list_page_img,from_unixtime(a.create_time) as create_time,a.service_count,a.type,b.shop_mobile_phone,b.truename,c.option_name,d.type_name,e.img_url as
list_page_img FROM ".$ecs->table('shop_service')." as a left join ecs_business_service_join as b on a.user_id=b.user_id left join ecs_service_option as c on a.option_id=c.id left join ecs_join_shop_type as d on b.shop_type=d.id left join ecs_user_pic as e
on a.list_page_img=e.id where a.status=1 order by a.create_time LIMIT " . $filter['start'] . ',' . $filter['page_size'];
set_filter($filter, $sql);
$rs = $GLOBALS['db']->getAll($sql);
foreach($rs as $k=>$v){
if($v['list_page_img'] != ''){
$rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . $v['list_page_img'];
}else{
$rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . 'default.png';
}
}
$lists = array('shop_service_list' => $rs, 'filter' => $filter,
'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
$smarty->assign('shop_service_list', $lists['shop_service_list']);
$smarty->assign('filter', $lists['filter']);
$smarty->assign('record_count', $lists['record_count']);
$smarty->assign('page_count', $lists['page_count']);
$smarty->assign('full_page', 1);
make_json_result($smarty->fetch('shop_service_list.htm'), '', array('filter' => $lists['filter'], 'page_count' => $lists['page_count']));
}
//-- 商铺服务列表
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list')
{
/* 检查权限 */
admin_priv('shop_service');
//包含分页方法
$sql = "SELECT COUNT(*) FROM " . $ecs->table('shop_service') . " where status=1";
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
$sql = "SELECT a.id as service_id,a.user_id,a.option_id,a.service_name,a.market_price,a.promote_price,a.list_page_img,from_unixtime(a.create_time) as create_time,a.service_count,a.type,b.shop_mobile_phone,b.truename,c.option_name,d.type_name,e.img_url as
list_page_img FROM ".$ecs->table('shop_service')." as a left join ecs_business_service_join as b on a.user_id=b.user_id left join ecs_service_option as c on a.option_id=c.id left join ecs_join_shop_type as d on b.shop_type=d.id left join ecs_user_pic as e
on a.list_page_img=e.id where a.status=1 order by a.create_time LIMIT " . $filter['start'] . ',' . $filter['page_size'];
set_filter($filter, $sql);
$rs = $GLOBALS['db']->getAll($sql);
foreach($rs as $k=>$v){
if($v['list_page_img'] != ''){
$rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . $v['list_page_img'];
}else{
$rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . 'default.png';
}
}
$lists = array('shop_service_list' => $rs, 'filter' => $filter,
'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
$smarty->assign('shop_service_list', $lists['shop_service_list']);
$smarty->assign('filter', $lists['filter']);
$smarty->assign('record_count', $lists['record_count']);
$smarty->assign('page_count', $lists['page_count']);
$smarty->assign('full_page', 1);
$smarty->display('shop_service_list.htm');
}
elseif ($_REQUEST['act'] == 'query'){
$sql = "SELECT COUNT(*) FROM " . $ecs->table('shop_service') . " where status=1";
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
$sql = "SELECT a.id as service_id,a.user_id,a.option_id,a.service_name,a.market_price,a.promote_price,a.list_page_img,from_unixtime(a.create_time) as create_time,a.service_count,a.type,b.shop_mobile_phone,b.truename,c.option_name,d.type_name,e.img_url as
list_page_img FROM ".$ecs->table('shop_service')." as a left join ecs_business_service_join as b on a.user_id=b.user_id left join ecs_service_option as c on a.option_id=c.id left join ecs_join_shop_type as d on b.shop_type=d.id left join ecs_user_pic as e
on a.list_page_img=e.id where a.status=1 order by a.create_time LIMIT " . $filter['start'] . ',' . $filter['page_size'];
set_filter($filter, $sql);
$rs = $GLOBALS['db']->getAll($sql);
foreach($rs as $k=>$v){
if($v['list_page_img'] != ''){
$rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . $v['list_page_img'];
}else{
$rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . 'default.png';
}
}
$lists = array('shop_service_list' => $rs, 'filter' => $filter,
'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
$smarty->assign('shop_service_list', $lists['shop_service_list']);
$smarty->assign('filter', $lists['filter']);
$smarty->assign('record_count', $lists['record_count']);
$smarty->assign('page_count', $lists['page_count']);
$smarty->assign('full_page', 1);
make_json_result($smarty->fetch('shop_service_list.htm'), '', array('filter' => $lists['filter'], 'page_count' => $lists['page_count']));
}
相关文章推荐
- docker attch退出
- linux_for_each_entry
- Hive 1.2.1&Spark&Sqoop安装指南
- Linux 双链表 list_for_each_entry 实现
- linux小白学习笔记(一)常用基础命令
- docker --help
- 使用xshell及xftp上传下载文件或目录
- open("/dev/mem ",O_RDWR | O_SYNC)
- 逻辑架构和物理架构
- linux select函数详解
- e.preventDefault()与e.stopPropagation()的区别
- openstack学习指南
- apache2.2后修改最大并发连接数
- hadoop学习点滴,积累
- Linux常用命令之三
- 为什么要学习Linux?
- 使用Apache的ab工具进行压力测试
- dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
- Linux学习要点(转载自红联)
- VMware安装CentOS