function.ua_get_offers.php
来自「支持中、英、繁三种语言; 3、提供9套风格任意转换; 4、内嵌全球免」· PHP 代码 · 共 41 行
PHP
41 行
<?php
//可以允许前台自定义输出多少供求
function smarty_function_ua_get_offers($params){
global $trade;
global $company;
global $g_db;
$this_trade_type = null;
$conditions = array();
$limit = null;
//企业类型:company_type
extract($params);
$conditions[] = "Trade.status=1";
if(isset($params['company_type'])) $conditions[] = "Company.type_id=".$params['company_type'];
if(isset($params['company_id'])) $conditions[] = "Trade.company_id=".$params['company_id'];
//max_offer:最多供求数
if(isset($params['max'])) {
$limit = intval($params['max']);
$limit = " limit ".$limit;
}else{
$limit = " limit 25";
}
if (isset($params['class'])) {
$style_class = "class='".$params['class']."'";
}
if(isset($params['trade_type'])) {
$conditions[] = "Trade.type_id='".$params['trade_type']."'";
$this_trade_type = $trade->setTradeCat($params['trade_type']);
}
$fields = "Trade.type_id as TradeTypeId,Trade.id AS TradeId,Trade.topic AS Name,html_file_id,submit_time as PublishTime";
$tmp_cond = implode(" and ", $conditions);
$sql = "select ".$fields." from ".$trade->getTable(true)." left join ".$company->getTable(true)." on Trade.company_id=Company.id where ".$tmp_cond.$limit;
$result = $g_db->GetAll($sql);
$output = "<div id='noffer' ".$style_class."><ul>\n";
foreach($result as $key=>$val){
$this_trade_cat = (isset($this_trade_type))?$this_trade_type:$trade->setTradeCat($val['TradeTypeId']);
$output.="<li><a href='".URL.$this_trade_cat."/content.php?id=".$val['TradeId']."' target='_blank'>".$val['Name']."</a></li>\n";
}
$output.="</ul></div>";
return $output;
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?