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