You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
5.5 KiB
149 lines
5.5 KiB
<?php
|
|
|
|
/**
|
|
* ECSHOP 文章分类
|
|
* ============================================================================
|
|
* * 版权所有 2005-2016 上海商创网络科技有限公司,并保留所有权利。
|
|
* 网站地址: http://www.ecmoban.com;
|
|
* ----------------------------------------------------------------------------
|
|
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
|
|
* 使用;不允许对程序代码以任何形式任何目的的再发布。
|
|
* ============================================================================
|
|
* $Author: liubo $
|
|
* $Id: article_cat.php 17217 2011-01-19 06:29:08Z liubo $
|
|
*/
|
|
|
|
|
|
define('IN_ECS', true);
|
|
|
|
require(dirname(__FILE__) . '/includes/init.php');
|
|
|
|
if ((DEBUG_MODE & 2) != 2)
|
|
{
|
|
$smarty->caching = true;
|
|
}
|
|
|
|
require(ROOT_PATH . '/includes/lib_area.php'); //ecmoban模板堂 --zhuo
|
|
|
|
/*------------------------------------------------------ */
|
|
//-- INPUT
|
|
/*------------------------------------------------------ */
|
|
|
|
/* 获得指定的分类ID */
|
|
if (!empty($_GET['id']))
|
|
{
|
|
$cat_id = intval($_GET['id']);
|
|
}
|
|
elseif (!empty($_GET['category']))
|
|
{
|
|
$cat_id = intval($_GET['category']);
|
|
}
|
|
else
|
|
{
|
|
ecs_header("Location: ./\n");
|
|
|
|
exit;
|
|
}
|
|
|
|
/* 获得当前页码 */
|
|
$page = !empty($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1;
|
|
|
|
/*------------------------------------------------------ */
|
|
//-- PROCESSOR
|
|
/*------------------------------------------------------ */
|
|
|
|
/* 获得页面的缓存ID */
|
|
$cache_id = sprintf('%X', crc32($cat_id . '-' . $page . '-' . $_CFG['lang']));
|
|
|
|
if (!$smarty->is_cached('article_cat.dwt', $cache_id))
|
|
{
|
|
/* 如果页面没有被缓存则重新获得页面的内容 */
|
|
|
|
assign_template('a', array($cat_id));
|
|
$position = assign_ur_here($cat_id);
|
|
$smarty->assign('helps', get_shop_help()); // 网店帮助
|
|
$smarty->assign('page_title', $position['title']); // 页面标题
|
|
$smarty->assign('ur_here', $position['ur_here']); // 当前位置
|
|
$categories_pro = get_category_tree_leve_one();
|
|
$smarty->assign('categories_pro', $categories_pro); // 分类树加强版
|
|
$smarty->assign('sys_categories', article_categories_tree(0,2)); //系统保留文章分类树by wang
|
|
$smarty->assign('custom_categories', article_categories_tree(0,1)); //自定义文章分类树by wang
|
|
|
|
//ecmoban模板堂 --zhuo start
|
|
$cat_list = get_cat_list($cat_id);
|
|
$child_count = count($cat_list[0]['child_list']);
|
|
|
|
if($child_count == 0){
|
|
$cat_list = get_cat_list($cat_list[0]['parent_id']);
|
|
$child_count = count($cat_list[0]['child_list']);
|
|
}
|
|
|
|
$smarty->assign('cat_list', $cat_list); // 文章分类
|
|
$smarty->assign('child_count', $child_count);
|
|
//ecmoban模板堂 --zhuo end
|
|
|
|
$smarty->assign('top_goods', get_top10()); // 销售排行
|
|
|
|
$smarty->assign('best_goods', get_recommend_goods('best'));
|
|
$smarty->assign('new_goods', get_recommend_goods('new'));
|
|
$smarty->assign('hot_goods', get_recommend_goods('hot'));
|
|
$smarty->assign('promotion_goods', get_promote_goods());
|
|
$smarty->assign('promotion_info', get_promotion_info());
|
|
|
|
/* Meta */
|
|
$meta = $db->getRow("SELECT keywords, cat_name ,cat_desc,cat_type FROM " . $ecs->table('article_cat') . " WHERE cat_id = '$cat_id'");
|
|
|
|
if($meta === false || empty($meta))
|
|
{
|
|
/* 如果没有找到任何记录则返回首页 */
|
|
ecs_header("Location: ./\n");
|
|
exit;
|
|
}
|
|
$smarty->assign('cat_info',$meta);
|
|
$smarty->assign('keywords', htmlspecialchars($meta['keywords']));
|
|
$smarty->assign('description', htmlspecialchars($meta['cat_desc']));
|
|
$smarty->assign('cat_name', $meta['cat_name']);
|
|
|
|
/* 获得文章总数 */
|
|
$size = isset($_CFG['article_page_size']) && intval($_CFG['article_page_size']) > 0 ? intval($_CFG['article_page_size']) : 20;
|
|
$count = get_article_count($cat_id);
|
|
$pages = ($count > 0) ? ceil($count / $size) : 1;
|
|
|
|
if ($page > $pages)
|
|
{
|
|
$page = $pages;
|
|
}
|
|
$pager['search']['id'] = $cat_id;
|
|
$keywords = '';
|
|
$goon_keywords = ''; //继续传递的搜索关键词
|
|
|
|
/* 获得文章列表 */
|
|
if (isset($_REQUEST['keywords']))
|
|
{
|
|
$keywords = addslashes(htmlspecialchars(urldecode(trim($_REQUEST['keywords']))));
|
|
$pager['search']['keywords'] = $keywords;
|
|
$search_url = substr(strrchr($_POST['cur_url'], '/'), 1);
|
|
|
|
$smarty->assign('search_value', stripslashes(stripslashes($keywords)));
|
|
$smarty->assign('search_url', $search_url);
|
|
$count = get_article_count($cat_id, $keywords);
|
|
$pages = ($count > 0) ? ceil($count / $size) : 1;
|
|
if ($page > $pages)
|
|
{
|
|
$page = $pages;
|
|
}
|
|
|
|
$goon_keywords = urlencode($_REQUEST['keywords']);
|
|
}
|
|
$smarty->assign('artciles_list', get_cat_articles($cat_id, $page, $size ,$keywords));
|
|
$smarty->assign('cat_id', $cat_id);
|
|
/* 分页 */
|
|
assign_pager('article_cat', $cat_id, $count, $size, '', '', $page, $goon_keywords);
|
|
assign_dynamic('article_cat');
|
|
}
|
|
|
|
$smarty->assign('feed_url', ($_CFG['rewrite'] == 1) ? "feed-typearticle_cat" . $cat_id . ".xml" : 'feed.php?type=article_cat' . $cat_id); // RSS URL
|
|
|
|
$smarty->display('article_cat.dwt', $cache_id);
|
|
|
|
?>
|