本文整理汇总了PHP中assign_brand_goods函数的典型用法代码示例。如果您正苦于以下问题:PHP assign_brand_goods函数的具体用法?PHP assign_brand_goods怎么用?PHP assign_brand_goods使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assign_brand_goods函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assign_dynamic
/**
* 获得指定页面的动态内容
*
* @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;
}
}
}
示例2: define
* 版权所有 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;
示例3: elseif
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;
示例4: assign_dynamic
/**
* 获得指定页面的动态内容
*
* @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;
}