分享好友 教程资讯首页 频道列表

DESTOON调用公司设置任意字段信息的方案

2023-10-06 20:00380

1、这是商铺的设置参数

把以下函数加入到api/extend.func.php 中

  1. //获取公司setting表里的值
  2. function xh_com_setting($userid, $key = '', $cache = '') {
  3.     global $db;
  4.     if($key) {
  5.         $r = $db->get_one("SELECT * FROM {$db->pre}company_setting WHERE userid=$userid AND item_key='$key'", $cache);
  6.         return $r ? $r['item_value'] : '';
  7.     } else {
  8.         $setting = array();
  9.         if($cache) {
  10.             $query = $db->query("SELECT * FROM {$db->pre}company_setting WHERE userid=$userid AND item_key<>'mypage'", $cache);
  11.         } else {
  12.             $query = $db->query("SELECT * FROM {$db->pre}company_setting WHERE userid=$userid", $cache);
  13.         }
  14.         while($r = $db->fetch_array($query)) {
  15.             $setting[$r['item_key']] = $r['item_value'];
  16.         }
  17.         return $setting;
  18.     }
  19. }



然后使用

  1. {xh_com_setting($t[userid], '字段')}


在公司列表循环中调用

比如在公司列表页调用 公司自定义LOGO

  1. {xh_com_setting($t[userid] ,'logo')}


调取时详情用

  1. {php $xh = userinfo($username);}
  2. {getcom_item($xh[userid], 'logo')}



2、其他模块调取公司表的参数

把以下函数加入到api/extend.func.php 中

  1. //获取公司表的值
  2. function xh_company($userid, $key = '') {
  3.     global $db;
  4.     if($key) {
  5.         $r = $db->get_one("SELECT `$key` FROM {$db->pre}company WHERE userid=$userid");
  6.         return $r ? $r[$key] : '';
  7.     } 
  8. }


在其他模块调取(主要是先得到用户名 username)

如:公司主营(列表方式)

  1. {php $xh = userinfo($t[username]);}
  2. {xh_company($xh[userid], 'business')}


如:公司主营(详情方式)

  1. {php $xh = userinfo($username);}
  2. {xh_company($xh[userid], 'business')}



反对 0
举报 0
收藏 0
打赏 0
评论 0
根据itemid调用改信息的content
在自定义函数中\api\extend.func.php中加入以下代码注释如下//根据文章id获取分表内容//第一个参数$moduleid 如果是在非当前模块使用需要写死,如在站点首页: {ge

0评论2023-10-0887

最新被收藏数量统计调用
在api/extend.func.php 中加入以下函数//获取单个信息被收藏数function xh_favorite($mid,$itemid){global $db;$nums = $db-get_one(SELECt COUNT(*) AS num FRO

0评论2023-10-08110

DESTOON二次开发调用该用户会员注册了多少时间的教程
在自定义函数 api/extend.func.php 中添加以下新函数//会员注册了多少时间统计function from_date($regtime){global $DT_TIME;$time = $DT_TIME - $regtime;if($

0评论2023-10-08106

DESTOON 调用会员注册了多少时间的方法
在自定义函数里 api/extend.func.php 中添加以下函数//计算注册时间function from_date($regtime){global $DT_TIME;$time = $DT_TIME - $regtime;if($time315360

0评论2023-10-08119

DESTOON 内容页批量调用所有自定义字段的方法
destoon 内容页批量调用所有自定义字段的方法一个一个的在模板里调,是不是太麻烦了,下面的方法就是批量循环出当前频道所有不为空的自定义字段内容。api/extend

0评论2023-10-0848

其他页面如何调用公司模块的分类名称
在自定义函数文件中根目录(api/extend.func.php)加入function getcat($catid) {global $db;$catids=explode(',',$catid);$catid=$catids[1];$r=$db-ge

0评论2023-10-0844

DESTOON列表页调用公司评论方法
在api/extend.func.php 中加入以下函数function commentnum($userid) { global $db; $r = $db-get_one(selec * from {$db-pre}comment wher item_id='$useri

0评论2023-10-0851

DESTOON 供应内容页调用供应类型的方法
调用供应,求购类型的方法,用得着的时候虽然不多,但记录下在api/extend.func.php 中加入以下函数//类型function ext_type($typeid){ global $MOD; $type = exp

0评论2023-10-0835

DESTOON资讯列表页调用tag标签的方法
将以下函数加入自定义函数文件 api/extend.func.php 中//关健词,tagfunctionkw_tag($tag){$tag=explode('',$tag);return$tag;}列表循环中加入,加在文

0评论2023-10-0837