本文整理汇总了PHP中get_categories_tree函数的典型用法代码示例。如果您正苦于以下问题:PHP get_categories_tree函数的具体用法?PHP get_categories_tree怎么用?PHP get_categories_tree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_categories_tree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_list
function action_list()
{
$smarty = $GLOBALS['smarty'];
/* 取得预售活动总数 */
$count = pre_sale_count();
if ($count > 0) {
/* 取得每页记录数 */
$size = isset($_CFG['page_size']) && intval($_CFG['page_size']) > 0 ? intval($_CFG['page_size']) : 12;
/* 计算总页数 */
$page_count = ceil($count / $size);
/* 取得当前页 */
$page = isset($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1;
$page = $page > $page_count ? $page_count : $page;
/* 缓存id:语言 - 每页记录数 - 当前页 */
$cache_id = $_CFG['lang'] . '-' . $size . '-' . $page;
$cache_id = sprintf('%X', crc32($cache_id));
} else {
/* 缓存id:语言 */
$cache_id = $_CFG['lang'];
$cache_id = sprintf('%X', crc32($cache_id));
}
assign_template();
/* 如果没有缓存,生成缓存 */
if (!$smarty->is_cached('pre_sale_list.dwt', $cache_id) || true) {
if ($count > 0) {
/* 取得当前页的预售活动 */
$ps_list = pre_sale_list($size, $page);
$smarty->assign('ps_list', $ps_list);
/* 设置分页链接 */
$pager = get_pager('pre_sale.php', array('act' => 'list'), $count, $page, $size);
$smarty->assign('pager', $pager);
}
/* 模板赋值 */
$smarty->assign('cfg', $_CFG);
assign_template();
$position = assign_ur_here();
$smarty->assign('page_title', $position['title']);
// 页面标题
$smarty->assign('ur_here', $position['ur_here']);
// 当前位置
$smarty->assign('categories', get_categories_tree());
// 分类树
$smarty->assign('helps', get_shop_help());
// 网店帮助
$smarty->assign('top_goods', get_top10());
// 销售排行
$smarty->assign('promotion_info', get_promotion_info());
$smarty->assign('feed_url', $_CFG['rewrite'] == 1 ? "feed-typepre_sale.xml" : 'feed.php?type=pre_sale');
// RSS
// URL
assign_dynamic('pre_sale_list');
}
/* 显示模板 */
$smarty->display('pre_sale_list.dwt', $cache_id);
}
示例2: falt_list
public function falt_list () {
$page = isset($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1;
$size = isset($_REQUEST['size']) && intval($_REQUEST['size']) > 0 ? intval($_REQUEST['size']) : 10;
$result = get_categories_tree();
if (!$result) {
$result = rpcLang('category.php', 'category_list_empty');
jsonExit("{\"status\":\"$result\"}");
}
//平铺
$flat_result = array();
arrayFlat($result, $flat_result);
$count = count($flat_result);
//获取分页信息
$pager = get_pager('category.php',$_GET, $count, $page, $size);
$flat_result = array_slice($flat_result,$pager['start'],$size);
//print_r(array('flat_result'=>$flat_result, 'pager'=>$pager));exit;
jsonExit(array('flat_result'=>$flat_result, 'pager'=>$pager));
}
示例3: get_linked_goods
$linked_goods = get_linked_goods($goods_id);
$goods['goods_style_name'] = add_style($goods['goods_name'], $goods['goods_name_style']);
/* 购买该商品可以得到多少钱的红包 */
if ($goods['bonus_type_id'] > 0) {
$time = gmtime();
$sql = "SELECT type_money FROM " . $ecs->table('bonus_type') . " WHERE type_id = '{$goods['bonus_type_id']}' " . " AND send_type = '" . SEND_BY_GOODS . "' " . " AND send_start_date <= '{$time}'" . " AND send_end_date >= '{$time}'";
$goods['bonus_money'] = floatval($db->getOne($sql));
if ($goods['bonus_money'] > 0) {
$goods['bonus_money'] = price_format($goods['bonus_money']);
}
}
$smarty->assign('goods', $goods);
$smarty->assign('goods_id', $goods['goods_id']);
$smarty->assign('bid_record', $bidrecord);
$smarty->assign('promote_end_time', $goods['gmt_end_time']);
$smarty->assign('categories', get_categories_tree());
// 分类树
/* meta */
$smarty->assign('keywords', htmlspecialchars($goods['keywords']));
$smarty->assign('description', htmlspecialchars($goods['goods_brief']));
$smarty->assign('navigator_list', get_navigator($ctype, $catlist));
//自定义导航栏
if (!empty($GLOBALS['_CFG']['search_keywords'])) {
$searchkeywords = explode(',', trim($GLOBALS['_CFG']['search_keywords']));
} else {
$searchkeywords = array();
}
$smarty->assign('searchkeywords', $searchkeywords);
//热搜关键词
/* 或得顶级分类产品名称*/
$sql = 'SELECT cat_id FROM ' . $GLOBALS['ecs']->table('goods') . ' where goods_id =' . $goods['goods_id'];
示例4: get_categories_tree
<?php
$_from = get_categories_tree(0);
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
$this->push_vars('', 'cat');
$this->_foreach['cat0'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['cat0']['total'] > 0) {
foreach ($_from as $this->_var['cat']) {
$this->_foreach['cat0']['iteration']++;
if ($this->_foreach['cat0']['iteration'] < 9) {
?>
<div class="list" onmouseover="_show_(this,{'source':'JS_side_cat_textarea_<?php
echo $this->_foreach['cat0']['iteration'];
?>
','target':'JS_side_cat_list_<?php
echo $this->_foreach['cat0']['iteration'];
?>
'});" onmouseout="_hide_(this);">
<dl class="cat" <?php
if ($this->_foreach['cat0']['iteration'] == $this->_foreach['cat0']['total'] || $this->_foreach['cat0']['iteration'] == 8) {
?>
style="border:none"<?php
}
?>
>
<dt class="catName">
<strong class="cat<?php
echo $this->_foreach['cat0']['iteration'];
?>
示例5: get_linked_goods
$shop_price = $goods['shop_price'];
$linked_goods = get_linked_goods($goods_id);
$goods['goods_style_name'] = add_style($goods['goods_name'], $goods['goods_name_style']);
/* 购买该商品可以得到多少钱的红包 */
if ($goods['bonus_type_id'] > 0) {
$time = gmtime();
$sql = "SELECT type_money FROM " . $ecs->table('bonus_type') . " WHERE type_id = '{$goods['bonus_type_id']}' " . " AND send_type = '" . SEND_BY_GOODS . "' " . " AND send_start_date <= '{$time}'" . " AND send_end_date >= '{$time}'";
$goods['bonus_money'] = floatval($db->getOne($sql));
if ($goods['bonus_money'] > 0) {
$goods['bonus_money'] = price_format($goods['bonus_money']);
}
}
$smarty->assign('goods', $goods);
$smarty->assign('goods_id', $goods['goods_id']);
$smarty->assign('promote_end_time', $goods['gmt_end_time']);
$smarty->assign('categories', get_categories_tree($goods['cat_id']));
// 分类树
$smarty->assign('zhekou', get_zhekou($goods['goods_id']));
$smarty->assign('jiesheng', get_jiesheng($goods['goods_id']));
/* meta */
$smarty->assign('keywords', htmlspecialchars($goods['keywords']));
$smarty->assign('description', htmlspecialchars($goods['goods_brief']));
$catlist = array();
foreach (get_parent_cats($goods['cat_id']) as $k => $v) {
$catlist[] = $v['cat_id'];
}
assign_template('c', $catlist);
/* 上一个商品下一个商品 */
$prev_gid = $db->getOne("SELECT goods_id FROM " . $ecs->table('goods') . " WHERE cat_id=" . $goods['cat_id'] . " AND goods_id > " . $goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1");
if (!empty($prev_gid)) {
$prev_good['url'] = build_uri('goods', array('gid' => $prev_gid), $goods['goods_name']);
示例6: show_message
/**
* 显示一个提示信息
*
* @access public
* @param string $content
* @param string $link
* @param string $href
* @param string $type 信息类型:warning, error, info
* @param string $auto_redirect 是否自动跳转
* @return void
*/
function show_message($content, $links = '', $hrefs = '', $type = 'info', $auto_redirect = true)
{
assign_template();
$msg['content'] = $content;
if (is_array($links) && is_array($hrefs)) {
if (!empty($links) && count($links) == count($hrefs)) {
foreach ($links as $key => $val) {
$msg['url_info'][$val] = $hrefs[$key];
}
$msg['back_url'] = $hrefs['0'];
}
} else {
$link = empty($links) ? $GLOBALS['_LANG']['back_up_page'] : $links;
$href = empty($hrefs) ? 'javascript:history.back()' : $hrefs;
$msg['url_info'][$link] = $href;
$msg['back_url'] = $href;
}
$msg['type'] = $type;
$position = assign_ur_here(0, $GLOBALS['_LANG']['sys_msg']);
$GLOBALS['smarty']->assign('page_title', $position['title']);
// 页面标题
$GLOBALS['smarty']->assign('ur_here', $position['ur_here']);
// 当前位置
if (is_null($GLOBALS['smarty']->get_template_vars('helps'))) {
$GLOBALS['smarty']->assign('helps', get_shop_help());
// 网店帮助
}
$GLOBALS['smarty']->assign('categories', get_categories_tree());
// 分类树
$GLOBALS['smarty']->assign('auto_redirect', $auto_redirect);
$GLOBALS['smarty']->assign('message', $msg);
$GLOBALS['smarty']->display('message.dwt');
exit;
}
示例7: elseif
$smarty->assign('act', $_REQUEST['act']);
$smarty->assign('panel', $_REQUEST['p']);
} elseif ($_REQUEST['act'] == 'choose') {
print_user();
//unset($_SESSION);
$search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '';
$cat_id = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : (!$search ? '1' : '');
//默认童装
$panel = isset($_REQUEST['panel']) ? $_REQUEST['panel'] : '';
$url = '?' . urldecode($_SERVER['QUERY_STRING']);
$goods_message = $class_print->category_goods($cat_id, $_SESSION[$panel], $search, $url, $page);
$html = $class_print->print_goods_html($_SESSION[$panel], $panel);
$smarty->assign('search', $search);
$smarty->assign('html', $html);
$smarty->assign('category', get_categories_tree(1));
$smarty->assign('panel', $panel);
$smarty->assign('page_html', $goods_message['page_html']);
$smarty->assign('goods_list', $goods_message['goods_list']);
$smarty->assign('cat_id', $cat_id);
$smarty->assign('act', $_REQUEST['act']);
} elseif ($_REQUEST['act'] == 'choose_add') {
print_user();
$goods_id = isset($_REQUEST['goods_id']) ? (int) $_REQUEST['goods_id'] : '0';
$panel = isset($_REQUEST['panel']) ? $_REQUEST['panel'] : '';
//unset($_SESSION[$panel]);
$html = '';
if (!$goods_id || !$panel) {
$msg = '0';
} else {
if (in_array($goods_id, $_SESSION[$panel])) {
示例8: array
* 2319 Est.Tower Van Palace
* No.2 Guandongdian South Street
* Beijing , China
*
* U.S. Office:
* One Park Place, Elmira College, NY, 14901, USA
*
* QQ Group: 329673575
* BBS: bbs.ecmobile.cn
* Fax: +86-10-6561-5510
* Mail: info@geek-zoo.com
*/
require EC_PATH . '/includes/init.php';
include_once EC_PATH . '/includes/lib_transaction.php';
$categoryGoods = array();
$category = get_categories_tree();
$category = array_merge($category);
//print_r($category);exit;
if (!empty($category)) {
foreach ($category as $key => $val) {
//$categoryGoods[$key][] = array(
$categoryGoods[$key]['id'] = $val['id'];
$categoryGoods[$key]['name'] = $val['name'];
//);
if (!empty($val['cat_id'])) {
foreach ($val['cat_id'] as $k => $v) {
$categoryGoods[$key]['children'][] = array('id' => $v['id'], 'name' => $v['name']);
}
} else {
$categoryGoods[$key]['children'] = array();
}
示例9: get_categories_tree
<?php
$this->assign('categories', get_categories_tree());
?>
<div id="sortlist">
<div class="mt"><h2>商品分类</h2></div>
<div class="mc">
<?php
$_from = $this->_var['categories'];
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
$this->push_vars('', 'cat_0_42047400_1418274503');
$this->_foreach['childnum'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['childnum']['total'] > 0) {
foreach ($_from as $this->_var['cat_0_42047400_1418274503']) {
$this->_foreach['childnum']['iteration']++;
?>
<div id="subitem<?php
echo $this->_foreach['childnum']['iteration'];
?>
" class="item"><h3 onclick="showmenu(<?php
echo $this->_foreach['childnum']['iteration'];
?>
)"><b></b><?php
echo htmlspecialchars($this->_var['cat_0_42047400_1418274503']['name']);
?>
</h3>
<ul>
<?php
示例10: get_categories_tree
<?php
$GLOBALS['smarty']->assign('categories', get_categories_tree(0));
// 分类树
?>
<div id="sortlist">
<div id="cate">
<?php
$_from = $this->_var['categories'];
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
$this->push_vars('', 'cat_0_10309700_1445445302');
$this->_foreach['cat'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['cat']['total'] > 0) {
foreach ($_from as $this->_var['cat_0_10309700_1445445302']) {
$this->_foreach['cat']['iteration']++;
?>
<div class='item <?php
if ($this->_var['cat_0_10309700_1445445302']['id'] == $this->_var['category']) {
?>
current<?php
}
?>
'>
<h3 onclick="tab(<?php
echo $this->_foreach['cat']['iteration'] - 1;
?>
)"><b></b><?php
示例11: db_create_in
{
$sql = $ext_sql . "b.attr_value = a.attr_value AND b.attr_id = " . $cat_filter_attr[$k] ." AND a.goods_attr_id = " . $v;
$ext_group_goods = $db->getColCached($sql);
$ext .= ' AND ' . db_create_in($ext_group_goods, 'g.goods_id');
}
}
}
}
assign_template('c', array($cat_id));
$position = assign_ur_here($cat_id, $brand_name);
$smarty->assign('page_title', $position['title']); // 页面标题
$smarty->assign('ur_here', $position['ur_here']); // 当前位置
$smarty->assign('categories', get_categories_tree($cat_id)); // 分类树
$smarty->assign('helps', get_shop_help()); // 网店帮助
$smarty->assign('top_goods', get_top10()); // 销售排行
$smarty->assign('show_marketprice', $_CFG['show_marketprice']);
$smarty->assign('category', $cat_id);
$smarty->assign('brand_id', $brand);
$smarty->assign('price_max', $price_max);
$smarty->assign('price_min', $price_min);
$smarty->assign('filter_attr', $filter_attr_str);
$smarty->assign('feed_url', ($_CFG['rewrite'] == 1) ? "feed-c$cat_id.xml" : 'feed.php?cat=' . $cat_id); // RSS URL
if ($brand > 0)
{
$arr['all'] = array('brand_id' => 0,
'brand_name' => $GLOBALS['_LANG']['all_goods'],
'brand_logo' => '',
示例12: unset
}
}
unset($_from);
$this->pop_vars();
?>
</ul>
</div>
<?php
}
?>
<div id="JS_goods_rel_cat" class="rel_cat mt10 none">
<h2 class="group_title">相关分类</h2>
<div id="JS_rel_cat" class="tab_body"><?php
$_from = get_categories_tree($GLOBALS[smarty]->_var[goods][cat_id]);
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
$this->push_vars('', 'cat');
$this->_foreach['get_categories_tree'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['get_categories_tree']['total'] > 0) {
foreach ($_from as $this->_var['cat']) {
$this->_foreach['get_categories_tree']['iteration']++;
?>
<a href="<?php
echo $this->_var['cat']['url'];
?>
" target="_blank" title="<?php
echo htmlspecialchars($this->_var['cat']['name']);
?>
示例13: GZ_guess_love
function GZ_guess_love()
{
include_once GZ_PATH . 'includes/lib_transaction.php';
$categoryGoods = array();
$category = get_categories_tree();
if (!empty($category)) {
foreach ($category as $key => $val) {
$goods = array();
$children = get_children($val['id']);
$goods = gz_get_category_recommend_goods('best', $children);
if (count($goods) > 7) {
$goods = array_slice($goods, 0, 7);
}
$ngoods = array();
if (!empty($goods)) {
foreach ($goods as $k => $v) {
$ngoods[] = array('goods_id' => $v['id'], 'name' => $v['name'], 'market_price' => $v['market_price'], 'shop_price' => $v['shop_price'], 'promote_price' => $v['promote_price'], 'brief' => $v['brief'], 'img' => array('thumb' => API_DATA('PHOTO', $v['goods_img']), 'url' => API_DATA('PHOTO', $v['original_img']), 'small' => API_DATA('PHOTO', $v['thumb'])));
}
}
$categoryGoods[] = array('id' => $val['id'], 'ico' => API_DATA('PHOTO', 'data/cat_ico/' . $val['ico']), 'desc' => $val['desc'], 'name' => $val['name'], 'goods' => $ngoods);
}
}
return $categoryGoods;
}
示例14: array
/* 首页推荐分类 */
$cat_recommend_res = $db->getAll("SELECT c.cat_id, c.cat_name, cr.recommend_type FROM " . $ecs->table("cat_recommend") . " AS cr INNER JOIN " . $ecs->table("category") . " AS c ON cr.cat_id=c.cat_id");
if (!empty($cat_recommend_res))
{
$cat_rec_array = array();
foreach($cat_recommend_res as $cat_recommend_data)
{
$cat_rec[$cat_recommend_data['recommend_type']][] = array('cat_id' => $cat_recommend_data['cat_id'], 'cat_name' => $cat_recommend_data['cat_name']);
}
$smarty->assign('cat_rec', $cat_rec);
}
/* 页面中的动态内容 */
assign_dynamic('index');
}
$cates = get_categories_tree();
$smarty->assign("cates",$cates[58]['cat_id']);
$smarty->display('index.dwt', $cache_id);
/*------------------------------------------------------ */
//-- PRIVATE FUNCTIONS
/*------------------------------------------------------ */
/**
* 调用发货单查询
*
* @access private
* @return array
*/
示例15: define
<?php
/**
* ECSHOP 分类聚合页
* ============================================================================
* * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。
* 网站地址: http://www.ecshop.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* $Author: liuhui $
* $Id: index.php 15013 2010-03-25 09:31:42Z liuhui $
*/
define('IN_ECTOUCH', true);
require dirname(__FILE__) . '/include/init.php';
$pcat_array = get_categories_tree();
foreach ($pcat_array as $key => $pcat_data) {
$pcat_array[$key]['name'] = $pcat_data['name'];
if ($pcat_data['cat_id']) {
foreach ($pcat_data['cat_id'] as $k => $v) {
$pcat_array[$key]['cat_id'][$k]['name'] = $v['name'];
}
}
}
$smarty->assign('pcat_array', $pcat_array);
$smarty->display("category_all.dwt");