您现在的位置是:首页 > cms教程 > Ecshop商城教程Ecshop商城教程

ecshop分页调用写法

夏彤2025-02-06Ecshop商城教程已有人查阅

导读ecshop分页是ajax请求的,必须在主文件里有个act=query处理,分页会请求这个act

ecshop分页是ajax请求的,必须在主文件里有个act=query处理,分页会请求这个act
<?php
//获取列表
if($_REQUEST['act']=='list'){
//权限设置
admin_priv('issued_invite_code');
$res = get_list();
$smarty-> assign('list',$res['list']);
$smarty-> assign('filter', $res['filter']);
$smarty-> assign('record_count', $res['filter']['record_count']);
$smarty-> assign('page_count', $res['filter']['page_count']);
assign_query_info();
$smarty->display('aa.html');
}
//分页ajax查询
if($_REQUEST['act'] == 'query'){
admin_priv('issued_invite_code');
$list = get_list();
$smarty-> assign('list',$res['list']);
$smarty-> assign('filter', $res['filter']);
$smarty-> assign('record_count', $res['filter']['record_count']);
$smarty-> assign('page_count', $res['filter']['page_count']);
$smarty->assign('is_ajax' ,true);
assign_query_info();
make_json_result($smarty->fetch('aa.html'), '',
array('filter' => $res['filter'], 'page_count' => $res['filter']['page_count']));
}
function get_list(){
$filter['record_count'] = $GLOBALS['db']->getOne("select count(*) from aa");
$filter = page_and_size($filter);
$sql = "select * from aa LIMIT $filter[start] , $filter[page_size]";
$list = $GLOBALS['db']-> getAll($sql);
return array('list'=>$list,'filter'=>$filter);
}
?>
{insert_scripts files="jquery.js,jquery.json.js,../js/transport.js,common.js"} //引入 必要的js
{insert_scripts files="../js/utils.js,listtable.js"} //引入 listtable.js
{if !$is_ajax} //如果是ajax分页就不显示表头
<h2 class="go-list">下发记录</h2>
{/if}
<div class="list-div" id="listDiv">
<table cellpadding="3" cellspacing="1">
<tr>
<th>id</th>
<th>名称</th>
</tr>
{if $list}
{foreach from=$list item=data}
<tr>
<td style="background-color: rgb(255, 255, 255);text-align: center;">{$data.id}</td>
<td style="background-color: rgb(255, 255, 255);text-align: center;">{$data.name}</td>
</tr>
{/foreach}
{else}
<tr>
<td>记录为空</td>
</tr>
{/if}
</table>
<table cellpadding="4" cellspacing="0">
<tr>
<td align="right">{include file="page.htm"}</td> //引入分页模板
</tr>
</table>
</div>

本文标签:

很赞哦! ()

相关源码

  • (PC+WAP)绿色环保设备环保企业网站模板源码下载基于PbootCMS内核开发的响应式企业模板,为环保设备制造、环境技术服务等企业打造,通过模块化设计实现多行业快速适配。查看源码
  • (自适应响应式)高新技术科技能源pbootcms网站HTML5模板本模板基于PbootCMS内核开发,为高新技术、科技研发、能源技术等科技型企业设计。采用HTML5+CSS3前沿技术,具备完善的响应式布局,能够自动适配手机、平板和电脑等多种终端设备。模板设计风格简约大气查看源码
  • 帝国CMS7.5H5小游戏模板游戏攻略下载网整站源码本模板基于帝国CMS系统开发,为H5小游戏和APP应用资讯类网站设计。模板架构针对小游戏行业特点优化,支持游戏发布、资讯分享、应用推荐等功能,满足各类小游戏门户网站的建设需求。查看源码
  • WordPress主题模板JustNews资讯博客类源码V5.2.2JustNews主题针对博客创作、自媒体运营及资讯发布类网站的需求而设计,提供专业的内容展示与管理方案。该主题集成前端用户中心功能,支持用户在前端界面发布和投稿文章,操作流程简洁高效。查看源码
  • (响应式H5)帝国cms7.5文章新闻博客模板带会员中心本模板基于帝国CMS内核开发,为新闻资讯、个人博客及作品展示类网站设计。采用响应式布局技术,确保在手机、平板和电脑等不同设备上都能获得良好的浏览体验。查看源码
  • (自适应HTML5)响应式智能设备人工智能机器pbootcms源码免费下载这款基于PbootCMS开发的网站模板为人工智能和智能设备行业设计,采用现代化科技风格,突出产品的智能特性和技术创新。模板架构合理,功能完善,能够有效展示各类智能产品的核心功能和解决方案。查看源码
分享笔记 (共有 篇笔记)
验证码:

本栏推荐