function get_hot_cat_tree($pid = 0, $rec = 3) { $arr = array(); $sql = "select c.* from " . $GLOBALS['ecs']->table('category') . " as c left join " . $GLOBALS['ecs']->table('cat_recommend') . " as rc on c.cat_id = rc.cat_id where rc.recommend_type={$rec} and c.parent_id={$pid} order by c.sort_order asc, c.cat_id asc"; $res = $GLOBALS['db']->getAll($sql); foreach ($res as $row) { $arr[$row['cat_id']]['id'] = $row['cat_id']; $arr[$row['cat_id']]['name'] = $row['cat_name']; $arr[$row['cat_id']]['url'] = build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']); $arr[$row['cat_id']]['chlid'] = get_hot_cat_tree($row['cat_id'], $rec); } return $arr; }
} ?> </span> <a href="<?php echo $this->_var['goods_cat']['url']; ?> " target="_blank"><?php echo htmlspecialchars($this->_var['goods_cat']['name']); ?> </a> </h2> <div class="recommend"> <div class="words"> <?php $ii = 0; $GLOBALS['smarty']->assign('child_cat', get_hot_cat_tree($GLOBALS['smarty']->_var['goods_cat']['id'], 3)); ?> <?php $_from = $this->_var['child_cat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $this->push_vars('', 'cat_0_27053500_1445444788'); $this->_foreach['name1'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['name1']['total'] > 0) { foreach ($_from as $this->_var['cat_0_27053500_1445444788']) { $this->_foreach['name1']['iteration']++; ?> <?php $_from = $this->_var['cat_0_27053500_1445444788']['child'];