公司LOGO调用方法

来源: https://destoon.cc/ 日期: 2019-03-01 19:57:15 人气: - 评论: 0

1、在/include中 查找到  global.func.php  这个文件
在这个文件中添加一个函数:

function get_company_setting($userid, $key = '', $cache = '') {
    global $db;
    if($key) {
        $r = $db->get_one("SELECt * FROM {$db->pre}company_setting WHERe userid=$userid AND item_key='$key'", $cache);
        return $r ? $r['item_value'] : '';
    } else {
        $setting = array();
        if($cache) {
            $query = $db->query("SELECt * FROM {$db->pre}company_setting WHERe userid=$userid", $cache);
        } else {
            $query = $db->query("SELECt * FROM {$db->pre}company_setting WHERe userid=$userid", $cache);
        }
        while($r = $db->fetch_array($query)) {
            $setting[$r['item_key']] = $r['item_value'];
        }
        return $setting;
    }
}

这个函数在module->company->global.func.php 中也有直接复制就行了    同时删掉 这个文件中的 这个函数,不然进company 会因为加载了两个同名函数而报错!

2、在首页需要显示logo的地方运用此函数

<!--{php $tags=tag("table=category&condition=parentid=0 and moduleid=4&order=listorder asc&template=null");}-->
    {loop $tags $i $t}
    <div id="xHTabC_{$i+1}" {if $i==0}class="newcar_con" style="display: block;margin-top: 10px; min-height:110px;"{/if} {if $i>0}  class="newcar_con" style="display: none;margin-top: 10px; min-height:110px; "{/if} >
        <ul>
        <!--{php $tags2=tag("moduleid=4&condition=vip>0 and level>0 and catids like '%,".$t[catid].",%'&order=fromtime desc&template=null");}-->
                {loop $tags2 $t2}
               <li style="width:130px; overflow:hidden; float:left; min-height:110px;">
               <div style="width:130px;text-align: center; height:110px; overflow:hidden; float:left; padding:0px">
               <a href="{$t2[linkurl]}" target="_blank"><img src="{get_company_setting($t2[userid], $key = 'logo', $cache = '')}" width="80" height="80" alt=""/>    
               <br><span>{$t2[company]}</span></a></div> 
               </li>
                {/loop}
            
         </ul>
     </div>
    
    
    {/loop}