{eyou:list merchant_id = "1" pagesize="20" titlelen="40" id="field_2"}
<div class="web_imglb-item brick-item-m-2"> <a href="{$field_2.arcurl}" title="{$field_2.title}">
<div class="web_imglb-tp"><img src="{$field_2.litpic}" alt="{$field_2.title}"/></div>
<div class="web_imglb-home">
<div class="web_pic-tit web-txt">{$field_2.title}</div>
<div class="price-num">
<div class="price fl">¥{$field_2.users_price}元</div>
<div class="num fr">已售:{$field_2.sales_num}件</div>
</div>
</div>
</a> </div>
{/eyou:list}
后臺代碼:
public function tagList($tag, $content)
{
$typeid = !empty($tag['typeid']) ? $tag['typeid'] : '';
$typeid = $this->varOrvalue($typeid);
$notypeid = !empty($tag['notypeid']) ? $tag['notypeid'] : '';
$notypeid = $this->varOrvalue($notypeid);
$modelid = isset($tag['modelid']) ? $tag['modelid'] : (isset($tag['channelid']) ? $tag['channelid'] : '');
$modelid = $this->varOrvalue($modelid);
$addfields = isset($tag['addfields']) ? $tag['addfields'] : '';
$addfields = $this->varOrvalue($addfields);
$keyword = isset($tag['keyword']) ? $tag['keyword'] : '';
$keyword = $this->varOrvalue($keyword);
$idlist = isset($tag['idlist']) ? $tag['idlist'] : '';
$idlist = $this->varOrvalue($idlist);
$idrange = isset($tag['idrange']) ? $tag['idrange'] : '';
$idrange = $this->varOrvalue($idrange);
$merchant_id = isset($tag['merchant_id']) ? $tag['merchant_id'] : 0;
$merchant_id = $this->varOrvalue($merchant_id);
$id = isset($tag['id']) ? $tag['id'] : 'field';
$key = !empty($tag['key']) ? $tag['key'] : 'i';
$empty = isset($tag['empty']) ? $tag['empty'] : '';
$empty = htmlspecialchars($empty);
$mod = !empty($tag['mod']) && is_numeric($tag['mod']) ? $tag['mod'] : '2';
if (isset($tag['loop'])) $tag['pagesize'] = $tag['loop'];
$pagesize = !empty($tag['pagesize']) && is_numeric($tag['pagesize']) ? intval($tag['pagesize']) : 10;
$thumb = !empty($tag['thumb']) ? $tag['thumb'] : 'on';
$orderby = isset($tag['orderby']) ? $tag['orderby'] : '';
$ordermode = 'desc';
if (!empty($tag['ordermode'])) {
$ordermode = $tag['ordermode'];
} else {
if (!empty($tag['orderWay'])) {
$ordermode = $tag['orderWay'];
} else {
$ordermode = !empty($tag['orderway']) ? $tag['orderway'] : $ordermode;
}
}
$flag = isset($tag['flag']) ? $tag['flag'] : '';
$noflag = isset($tag['noflag']) ? $tag['noflag'] : '';
$titlelen = !empty($tag['titlelen']) && is_numeric($tag['titlelen']) ? intval($tag['titlelen']) : 100;
$bodylen = !empty($tag['bodylen']) && is_numeric($tag['bodylen']) ? intval($tag['bodylen']) : 160;
if (isset($tag['infolen'])) {
$bodylen = !empty($tag['infolen']) && is_numeric($tag['infolen']) ? intval($tag['infolen']) : 160;
}
$arcrank = !empty($tag['arcrank']) ? $tag['arcrank'] : 'off';
$siteall = isset($tag['siteall']) ? $tag['siteall'] : null;
$parseStr = '<?php ';
// 聲明變量
/*typeid的優(yōu)先級別從高到低:裝修數(shù)據(jù) -> 標簽屬性值 -> 外層標簽channelartlist屬性值*/
$parseStr .= ' $typeid = '.$typeid.'; ';
$parseStr .= ' if(empty($typeid) && isset($channelartlist["id"]) && !empty($channelartlist["id"])) : $typeid = intval($channelartlist["id"]); endif; ';
/*--end*/
// 查詢數(shù)據(jù)庫獲取的數(shù)據(jù)集
$parseStr .= ' $param = array(';
$parseStr .= ' "typeid"=> $typeid,';
$parseStr .= ' "notypeid"=> '.$notypeid.',';
$parseStr .= ' "flag"=> "'.$flag.'",';
$parseStr .= ' "noflag"=> "'.$noflag.'",';
$parseStr .= ' "channel"=> '.$modelid.',';
$parseStr .= ' "keyword"=> '.$keyword.',';
$parseStr .= ' "idlist"=> '.$idlist.',';
$parseStr .= ' "idrange"=> '.$idrange.',';
$parseStr .= ' "merchant_id"=> $merchant_id,';
$parseStr .= ' );';
// $parseStr .= ' $orderby = "'.$orderby.'";';
$parseStr .= ' $tagList = new \think\template\taglib\eyou\TagList;';
$parseStr .= ' $_result_tmp = $tagList->getList($param, '.$pagesize.', "'.$orderby.'", '.$addfields.', "'.$ordermode.'", "'.$thumb.'","'.$arcrank.'","'.$siteall.'");';
$parseStr .= 'if(!empty($_result_tmp) && (is_array($_result_tmp) || $_result_tmp instanceof \think\Collection || $_result_tmp instanceof \think\Paginator)): $' . $key . ' = 0; $e = 1;';
$parseStr .= ' $__LIST__ = $_result = $_result_tmp["list"];';
$parseStr .= ' $__PAGES__ = $_result_tmp["pages"];';
$parseStr .= 'if( count($__LIST__)==0 ) : echo htmlspecialchars_decode("' . $empty . '");';
$parseStr .= 'else: ';
$parseStr .= 'foreach($__LIST__ as $key=>$' . $id . '): ';
$parseStr .= '$aid = $'.$id.'["aid"];';
$parseStr .= '$users_id = $'.$id.'["users_id"];';
$parseStr .= '$' . $id . '["title"] = text_msubstr($' . $id . '["title"], 0, '.$titlelen.', false);';
$parseStr .= '$' . $id . '["seo_description"] = text_msubstr($' . $id . '["seo_description"], 0, '.$bodylen.', true);';
$parseStr .= '$' . $key . '= intval($key) + 1;?>';
$parseStr .= '<?php $mod = ($' . $key . ' % ' . $mod . ' ); ?>';
$parseStr .= $content;
$parseStr .= '<?php ++$e; ?>';
$parseStr .= '<?php $aid = 0; ?>';
$parseStr .= '<?php $users_id = 0; ?>';
$parseStr .= '<?php endforeach; endif; else: echo htmlspecialchars_decode("' . $empty . '");endif; ?>';
$parseStr .= '<?php $'.$id.' = []; ?>'; // 清除變量值,只限于在標簽內(nèi)部使用
if (!empty($parseStr)) {
return $parseStr;
}
return;
}
這個$merchant_id 獲取不到前端的值
{eyou:list merchant_id = "1" pagesize="20" titlelen="40" id="field_2"}
求問,怎么加個merchant_id的條件,最好是能選擇的變量值