ecshop -> 后台 分页

article.php

<?php

/**
 * ECSHOP 管理中心文章处理程序文件
 * ============================================================================
 * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.ecshop.com;
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用;不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: liuhui $
 * $Id: article.php 17095 2010-04-12 10:26:10Z liuhui $
*/

define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');

/*------------------------------------------------------ */
//-- 文章列表
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list')
{
    /* 取得过滤条件 */
    $filter = array();
    $smarty->assign('ur_here',      $_LANG['03_article_list']);
    $smarty->assign('action_link',  array('text' => $_LANG['article_add'], 'href' => 'article.php?act=add'));
    $smarty->assign('full_page',    1);
    $smarty->assign('filter',       $filter);

    $order_list = get_orderlist();

    $smarty->assign('order_list',    $order_list['arr']);
    $smarty->assign('filter',          $order_list['filter']);
    $smarty->assign('record_count',    $order_list['record_count']);
    $smarty->assign('page_count',      $order_list['page_count']);

    assign_query_info();
    $smarty->display('article_list.htm');
}

/*------------------------------------------------------ */
//-- 翻页,排序
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'query')
{
    check_authz_json('article_manage');

    $order_list = get_orderlist();

    $smarty->assign('order_list',    $order_list['arr']);
    $smarty->assign('filter',          $order_list['filter']);
    $smarty->assign('record_count',    $order_list['record_count']);
    $smarty->assign('page_count',      $order_list['page_count']);

    make_json_result($smarty->fetch('article_list.htm'), '',
        array('filter' => $order_list['filter'], 'page_count' => $order_list['page_count']));
}

/* 获得文章列表 */
function get_orderlist()
{
    $result = get_filter();
    if ($result === false)
    {
        $filter = array();
        /* 文章总数 */
        $sql = 'SELECT COUNT(*) FROM ' .$GLOBALS['ecs']->table('orders');
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);

        /* 获取文章数据 */
        $sql = 'SELECT * FROM ' .$GLOBALS['ecs']->table('orders');
        set_filter($filter, $sql);
    }
    else
    {
        $sql    = $result['sql'];
        $filter = $result['filter'];
    }
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);

    while ($rows = $GLOBALS['db']->fetchRow($res))
    {
        $rows['date'] = local_date($GLOBALS['_CFG']['time_format'], $rows['add_time']);

        $arr[] = $rows;
    }
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}

?>

 

article_html

 

<!-- $Id: article_list.htm 16783 2009-11-09 09:59:06Z liuhui $ -->

{if $full_page}
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,listtable.js"}

<form method="POST" action="article.php?act=batch_remove" name="listForm">
<!-- start cat list -->
<div class="list-div" id="listDiv">
{/if}

<table cellspacing='1' cellpadding='3' id='list-table'>
  <tr>
    <th><a href="javascript:;">序号</a></th>
    <th><a href="javascript:;">订单编号</a></th>
    <th><a href="javascript:;">下单时间</a></th>
    <th><a href="javascript:;">联系人</a></th>
    <th><a href="javascript:;">联系手机</a></th>
    <th><a href="javascript:;">产品名称</a></th>
    <th><a href="javascript:;">操作</a></th>
  </tr>
  {foreach from=$order_list item=list}
  <tr>
    <td><span>{$list.oid}</span></td>
    <td class="first-cell"><span>{$list.onum}</span></td>
    <td align="left">{$list.odate}<span></span></td>
	<td align="left">{$list.username}<span></span></td>
	<td align="left">{$list.mobile}<span></span></td>
	<td align="left">{$list.goodsname}<span></span></td>
   </tr>
   {foreachelse}
    <tr><td class="no-records" colspan="10">{$lang.no_article}</td></tr>
  {/foreach}
  <tr>&nbsp;
    <td align="right" nowrap="true" colspan="8">{include file="page.htm"}</td>
  </tr>
</table>

{if $full_page}
</div>
</form>
<!-- end cat list -->
<script type="text/javascript" language="JavaScript">
  listTable.recordCount = {$record_count};
  listTable.pageCount = {$page_count};
  {foreach from=$filter item=item key=key}
  listTable.filter.{$key} = '{$item}';
  {/foreach}
</script>
{include file="pagefooter.htm"}
{/if}

 

 

你可能感兴趣的:(ecshop)