-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
108 lines (93 loc) · 3.28 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/**
* ECSHOP mobile首页
* ============================================================================
* * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。
* 网站地址: http://www.ecshop.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* $Author: liuhui $
* $Id: index.php 15013 2010-03-25 09:31:42Z liuhui $
*/
define('IN_ECS', true);
define('ECS_ADMIN', true);
require(dirname(__FILE__) . '/includes/init.php');
/* 广告 */
$index_ads_xml = file_get_contents('../data/flash_data.xml');
$index_ads = simplexml_load_string($index_ads_xml);
$smarty->assign('index_ads' , $index_ads);
/* 精品 */
$best_goods = get_recommend_goods('best');
$best_goods =array_slice($best_goods, 0, 3);
$smarty->assign('best_goods' , $best_goods);
/* 热门 */
$hot_goods = get_recommend_goods('hot');
$hot_goods =array_slice($hot_goods, 0, 3);
$smarty->assign('hot_goods' , $hot_goods);
/* 促销 */
$promote_goods = get_promote_goods();
$hot_goods =array_slice($hot_goods, 0, 3);
$smarty->assign('promote_goods' , $promote_goods);
/* 最新 */
$new_goods = get_recommend_goods('new');
$new_goods =array_slice($new_goods, 0, 3);
$smarty->assign('new_goods' , $new_goods);
$pcat_array = get_categories_tree();
foreach ($pcat_array as $key => $pcat_data)
{
$pcat_array[$key]['name'] = encode_output($pcat_data['name']);
if ($pcat_data['cat_id'])
{
if (count($pcat_data['cat_id']) > 3)
{
$pcat_array[$key]['cat_id'] = array_slice($pcat_data['cat_id'], 0, 3);
}
foreach ($pcat_array[$key]['cat_id'] as $k => $v)
{
$pcat_array[$key]['cat_id'][$k]['name'] = encode_output($v['name']);
}
}
}
$smarty->assign('pcat_array' , $pcat_array);
$brands_array = get_brands();
if (!empty($brands_array))
{
if (count($brands_array) > 3)
{
$brands_array = array_slice($brands_array, 0, 10);
}
foreach ($brands_array as $key => $brands_data)
{
$brands_array[$key]['brand_name'] = encode_output($brands_data['brand_name']);
}
$smarty->assign('brand_array', $brands_array);
}
$article_array = $db->GetALLCached("SELECT article_id, title FROM " . $ecs->table("article") . " WHERE cat_id != 0 AND is_open = 1 AND open_type = 0 ORDER BY article_id DESC LIMIT 0,4");
if (!empty($article_array))
{
foreach ($article_array as $key => $article_data)
{
$article_array[$key]['title'] = encode_output($article_data['title']);
}
$smarty->assign('article_array', $article_array);
}
if ($_SESSION['user_id'] > 0)
{
$smarty->assign('user_name', $_SESSION['user_name']);
}
if (!empty($GLOBALS['_CFG']['search_keywords']))
{
$searchkeywords = explode(',', trim($GLOBALS['_CFG']['search_keywords']));
}
else
{
$searchkeywords = array();
}
$smarty->assign('searchkeywords', $searchkeywords);
$smarty->assign('wap_logo', $_CFG['wap_logo']);
$smarty->assign('footer', get_footer());
$smarty->assign('login', $_SESSION['user_id'] > 0);
$smarty->display("index.html");
?>