本文整理汇总了PHP中bm函数的典型用法代码示例。如果您正苦于以下问题:PHP bm函数的具体用法?PHP bm怎么用?PHP bm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_header_gcategories
function get_header_gcategories($amount, $position, $brand_is_recommend = 1)
{
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = array();
if (!$amount) {
$gcategories = $gcategory_mod->get_list(-1, true);
} else {
$gcategory = $gcategory_mod->get_list(0, true);
$gcategories = $gcategory;
foreach ($gcategory as $val) {
$result = $gcategory_mod->get_list($val['cate_id'], true);
$result = array_slice($result, 0, $amount);
$gcategories = array_merge($gcategories, $result);
}
}
import('tree.lib');
$tree = new Tree();
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
$gcategory_list = $tree->getArrayList(0);
$i = 0;
$brand_mod =& m('brand');
foreach ($gcategory_list as $k => $v) {
$gcategory_list[$k]['top'] = isset($position[$i]) ? $position[$i] : '0px';
$i++;
$gcategory_list[$k]['brands'] = $brand_mod->find(array('conditions' => "tag = '" . $v['value'] . "' AND recommended=" . $brand_is_recommend, 'order' => 'sort_order asc,brand_id desc'));
}
return array('gcategories' => $gcategory_list);
}
示例2: _get_data
function _get_data()
{
$this->options['amount'] = intval($this->options['amount']);
$cache_server =& cache_server();
$key = $this->_get_cache_id();
$data = $cache_server->get($key);
if ($data === false) {
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = array();
if (empty($this->options['amount'])) {
$gcategories = $gcategory_mod->get_list(-1, true);
} else {
$gcategory = $gcategory_mod->get_list(0, true);
$gcategories = $gcategory;
foreach ($gcategory as $val) {
$result = $gcategory_mod->get_list($val['cate_id'], true);
$result = array_slice($result, 0, $this->options['amount']);
$gcategories = array_merge($gcategories, $result);
}
}
import('tree.lib');
$tree = new Tree();
//LLL 商品分类挂件根据语言选择分类字段
$lang2 = get_lang2();
//like fr,sc etc...
$gcategories = chg_array2_string($gcategories, 'cate_name', $lang2);
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
$data = $tree->getArrayList(0);
$cache_server->set($key, $data, $this->_ttl);
}
return $data;
}
示例3: _get_data
function _get_data()
{
$cache_server =& cache_server();
$key = $this->_get_cache_id();
$data = $cache_server->get($key);
if ($data === false) {
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = array();
$brand_mod =& m('brand');
if (empty($this->options['amount'])) {
$gcategories = $gcategory_mod->get_list(-1, true);
} else {
$gcategory = $gcategory_mod->get_list(0, true);
$gcategories = $gcategory;
foreach ($gcategory as $val) {
$result = $gcategory_mod->get_list($val['cate_id'], true);
$result = array_slice($result, 0, $this->options['amount']);
$gcategories = array_merge($gcategories, $result);
}
}
import('tree.lib');
$tree = new Tree();
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
$data = array('gcategories' => $tree->getArrayList(0), 'model_name' => $this->options['model_name'], 'brands' => $brand_mod->find(array('conditions' => "recommended = 1 AND if_show = 1", 'order' => 'sort_order', 'limit' => $this->_num)));
$cache_server->set($key, $data, $this->_ttl);
}
return $data;
}
示例4: DatacallModule
function DatacallModule()
{
parent::__construct();
$this->type = isset($_REQUEST['type']) ? intval($_REQUEST['type']) : 'goods';
$this->call_mod =& af('datacall');
$this->_gcategory_mod =& bm("gcategory");
}
示例5: ajax_cate
function ajax_cate()
{
if (!isset($_GET['id']) || empty($_GET['id'])) {
echo ecm_json_encode(false);
return;
}
$this->_gcategory_mod =& bm('gcategory');
$cate = $this->_gcategory_mod->get_list($_GET['id']);
foreach ($cate as $key => $val) {
$child = $this->_gcategory_mod->get_list($val['cate_id']);
$lay = $this->_gcategory_mod->get_layer($val['cate_id']);
if ($lay >= MAX_LAYER) {
$cate[$key]['add_child'] = 0;
} else {
$cate[$key]['add_child'] = 1;
}
if (!$child || empty($child)) {
$cate[$key]['switchs'] = 0;
} else {
$cate[$key]['switchs'] = 1;
}
}
header("Content-Type:text/html;charset=" . CHARSET);
echo ecm_json_encode(array_values($cate));
return;
}
示例6: ChannelApp
function ChannelApp()
{
parent::BackendApp();
$this->_channel_mod =& af('channels');
$this->_gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$this->_tpl_filepath = ROOT_PATH . '/themes/mall/' . $this->_get_template_name() . '/';
$this->_tpl_confpath = ROOT_PATH . '/data/page_config/';
$this->_tpl_url = SITE_URL . '/themes/mall/' . $this->_get_template_name() . '/styles/' . $this->_get_style_name();
}
示例7: _list_gcategory
function _list_gcategory()
{
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = $gcategory_mod->get_list(-1, true);
import('tree.lib');
$tree = new Tree();
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
return $tree->getArrayList(0);
}
示例8: get_cat_goods_total
function get_cat_goods_total($cate_id)
{
$goods_mod =& m('goods');
$gcategory_mod =& bm('gcategory');
$cate_ids = implode(",", $gcategory_mod->get_descendant_ids($cate_id));
if ($cate_id > 0) {
$conditions = " AND cate_id IN (" . $cate_ids . ")";
} else {
$conditions = '';
}
$goods = $goods_mod->find(array('conditions' => 'if_show=1 and closed=0 ' . $conditions, 'fields' => 'goods_id'));
return count($goods);
}
示例9: _list_gcategory
function _list_gcategory()
{
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = $gcategory_mod->get_list(-1, true);
import('tree.lib');
$tree = new Tree();
$lang2 = get_lang2();
//LLL 获取语言2个字母的代称,如fr, sc, en
$gcategories = chg_array2_string($gcategories, 'cate_name', $lang2);
//保留数组第二维字段字符串中指定语言的部分
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
return $tree->getArrayList(0);
}
示例10: _list_gcategory
function _list_gcategory()
{
$cache_server =& cache_server();
$key = 'page_goods_category';
$data = $cache_server->get($key);
if ($data === false) {
$gcategory_mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = $gcategory_mod->get_list(-1, true);
import('tree.lib');
$tree = new Tree();
$tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
$data = $tree->getArrayList(0);
$cache_server->set($key, $data, 3600);
}
return $data;
}
示例11: _get_data
function _get_data()
{
$gcategory_mod =& bm('gcategory');
$gcategories = array();
if (!empty($this->options['cate_id'])) {
$gcategorys = $gcategory_mod->get_children($this->options['cate_id']);
foreach ($gcategorys as $key => $cate) {
$gcategorys[$key]['children'] = array();
$gcategorys[$key]['children'] = $gcategory_mod->get_children($cate['cate_id']);
foreach ($gcategorys[$key]['children'] as $k => $v) {
$gcategorys[$key]['children'][$k]['children'] = $gcategory_mod->get_children($v['cate_id']);
}
}
}
$ads = array();
for ($i = 1; $i < 9; $i++) {
$ads[$i]['ad_image_url'] = $this->options['ad' . $i . '_image_url'];
$ads[$i]['ad_link_url'] = $this->options['ad' . $i . '_link_url'];
}
$data = array('model_color' => $this->options['model_color'], 're_store' => $this->options['re_store'], 'gcategories' => $gcategorys, 'ad0_image_url' => $this->options['ad0_image_url'], 'ads' => $ads, 'wid' => md5($this->options['model_color']));
return $data;
}
示例12: store_goods
function store_goods()
{
$goods_mod =& bm('goods', array('_store_id' => $this->_store_id));
/* 搜索条件 */
$conditions = "1 = 1";
if (trim($_GET['goods_name'])) {
$str = "LIKE '%" . trim($_GET['goods_name']) . "%'";
$conditions .= " AND (goods_name {$str})";
}
if (intval($_GET['sgcate_id']) > 0) {
$cate_mod =& bm('gcategory', array('_store_id' => $this->_store_id));
$cate_ids = $cate_mod->get_descendant(intval($_GET['sgcate_id']));
} else {
$cate_ids = 0;
}
/* 取得商品列表 */
$goods_list = $goods_mod->get_list(array('conditions' => $conditions . ' AND g.if_show=1 AND g.closed=0', 'order' => 'g.add_time DESC', 'limit' => 100), $cate_ids);
foreach ($goods_list as $key => $val) {
$goods_list[$key]['goods_name'] = htmlspecialchars($val['goods_name']);
}
$this->json_result($goods_list);
}
示例13: _get_gcategory_options
function _get_gcategory_options($parent_id = 0)
{
$mod_gcategory =& bm('gcategory');
$gcategories = $mod_gcategory->get_list($parent_id, true);
foreach ($gcategories as $gcategory) {
$res[$gcategory['cate_id']] = $gcategory['cate_name'];
}
return $res;
}
示例14: My_categoryApp
function My_categoryApp()
{
parent::__construct();
$this->_gcategory_mod =& bm('gcategory', array('_store_id' => $this->visitor->get('manage_store')));
}
示例15: _get_mgcategory_options
function _get_mgcategory_options($parent_id = 0)
{
$res = array();
$mod =& bm('gcategory', array('_store_id' => 0));
$gcategories = $mod->get_list($parent_id, true);
foreach ($gcategories as $gcategory) {
$res[$gcategory['cate_id']] = $gcategory['cate_name'];
}
return $res;
}