/**
 * 获得指定页面的动态内容
 *
 * @access  public
 * @param   string  $tmp    模板名称
 * @return  void
 */
function assign_dynamic($tmp)
{
    $sql = 'SELECT id, number, type FROM ' . $GLOBALS['ecs']->table('touch_template') . " WHERE filename = '{$tmp}' AND type > 0 AND remarks ='' AND theme='" . $GLOBALS['_CFG']['template'] . "'";
    $res = $GLOBALS['db']->getAll($sql);
    foreach ($res as $row) {
        switch ($row['type']) {
            case 1:
                /* 分类下的商品 */
                $GLOBALS['smarty']->assign('goods_cat_' . $row['id'], assign_cat_goods($row['id'], $row['number']));
                break;
            case 2:
                /* 品牌的商品 */
                $brand_goods = assign_brand_goods($row['id'], $row['number']);
                $GLOBALS['smarty']->assign('brand_goods_' . $row['id'], $brand_goods['goods']);
                $GLOBALS['smarty']->assign('goods_brand_' . $row['id'], $brand_goods['brand']);
                break;
            case 3:
                /* 文章列表 */
                $cat_articles = assign_articles($row['id'], $row['number']);
                $GLOBALS['smarty']->assign('articles_cat_' . $row['id'], $cat_articles['cat']);
                $GLOBALS['smarty']->assign('articles_' . $row['id'], $cat_articles['arr']);
                break;
        }
    }
}
Beispiel #2
0
 * 版权所有 2005-2011 上海商派网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.ecshop.com;
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用;不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: liubo $
 * $Id: brands.php 17217 2011-01-19 06:29:08Z liubo $
*/
define('IN_ECS', true);
require dirname(__FILE__) . '/includes/init.php';
$b_id = !empty($_GET['b_id']) ? intval($_GET['b_id']) : 0;
if ($b_id <= 0) {
    exit;
}
$brands_array = assign_brand_goods($b_id);
$brands_array['brand']['name'] = encode_output($brands_array['brand']['name']);
$smarty->assign('brands_array', $brands_array);
$num = count($brands_array['goods']);
if ($num > 0) {
    $page_num = '10';
    $page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
    $pages = ceil($num / $page_num);
    if ($page <= 0) {
        $page = 1;
    }
    if ($pages == 0) {
        $pages = 1;
    }
    if ($page > $pages) {
        $page = $pages;
Beispiel #3
0
 if ($get_sort == 'shop_price' && $get_order == 'DESC') {
     $order_rule = 'ORDER BY g.shop_price DESC, g.sort_order';
 } elseif ($get_sort == 'shop_price' && $get_order == 'ASC') {
     $order_rule = 'ORDER BY g.shop_price ASC, g.sort_order';
 } elseif ($get_sort == 'click_count' && $get_order == 'DESC') {
     $order_rule = 'ORDER BY g.click_count DESC, g.sort_order';
 } elseif ($get_sort == 'click_count' && $get_order == 'ASC') {
     $order_rule = 'ORDER BY g.click_count ASC, g.sort_order';
 } elseif ($get_sort == 'goods_id' && $get_order == 'DESC') {
     $order_rule = 'ORDER BY g.goods_id DESC, g.sort_order';
 } elseif ($get_sort == 'goods_id' && $get_order == 'ASC') {
     $order_rule = 'ORDER BY g.goods_id ASC, g.sort_order';
 } else {
     $order_rule = 'ORDER BY g.goods_id desc, g.sort_order';
 }
 $brands_array = assign_brand_goods($b_id, 0, 0, $order_rule);
 $brands_array['brand']['name'] = encode_output($brands_array['brand']['name']);
 $smarty->assign('brands_array', $brands_array);
 $num = count($brands_array['goods']);
 if ($num > 0) {
     $page_num = '10';
     $page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
     $pages = ceil($num / $page_num);
     if ($page <= 0) {
         $page = 1;
     }
     if ($pages == 0) {
         $pages = 1;
     }
     if ($page > $pages) {
         $page = $pages;
Beispiel #4
0
/**
 * 获得指定页面的动态内容
 *
 * @access  public
 * @param   string  $tmp    模板名称
 * @return  void
 */
function assign_dynamic($tmp)
{
    $sql = 'SELECT region,id, number, type FROM ' . $GLOBALS['ecs']->table('template') . " WHERE filename = '{$tmp}' AND type > 0 AND remarks ='' AND theme='" . $GLOBALS['_CFG']['template'] . "'";
    $res = $GLOBALS['db']->getAll($sql);
    //dump($res);
    foreach ($res as $row) {
        switch ($row['type']) {
            case 1:
                /* 加入拿商品条件 */
                if ($tmp == 'index') {
                    $nature = '';
                    if (strpos($row['region'], '新品') !== false) {
                        $nature = 'new';
                    } elseif (strpos($row['region'], '精品') !== false) {
                        $nature = 'best';
                    }
                }
                //echo $nature.'<br/>';
                //dump(assign_cat_goods($row['id'], $row['number'],'web','','1',$tmp,$nature));
                /* 分类下的商品 */
                $GLOBALS['smarty']->assign('goods_cat_' . $row['id'], assign_cat_goods($row['id'], $row['number'], 'web', '', '1', $tmp, $nature));
                //echo'<pre>';
                //print_r(assign_cat_goods($row['id'], $row['number']));
                break;
            case 2:
                /* 品牌的商品 */
                $brand_goods = assign_brand_goods($row['id'], $row['number']);
                $GLOBALS['smarty']->assign('brand_goods_' . $row['id'], $brand_goods['goods']);
                $GLOBALS['smarty']->assign('goods_brand_' . $row['id'], $brand_goods['brand']);
                break;
            case 3:
                /* 文章列表 */
                $cat_articles = assign_articles($row['id'], $row['number']);
                $GLOBALS['smarty']->assign('articles_cat_' . $row['id'], $cat_articles['cat']);
                $GLOBALS['smarty']->assign('articles_' . $row['id'], $cat_articles['arr']);
                break;
        }
    }
    //die;
}