phpcms V9调用全站最新文章的标签及修改使用方法 -云主机博士
修改方法:
第一步、
修改 phpcms\modules\content\classes\content_tag.class.php 在最后面的 } 上面添加
public function newcontent(ParseError: KaTeX parse error: Expected '}', got 'EOF' at end of input: data){num = intval(data[′limit′])?intval(data['limit']) ? intval(data[′limit′])?intval(data['limit']) : '20';
// 设置排序
switch(ParseError: KaTeX parse error: Expected '}', got 'EOF' at end of input: …{
case '1':order = ' `id` ASC ';
break;
case '2':
order=′‘id‘DESC′;break;case′3′:order = ' `id` DESC ';
break;
case '3':order=′‘id‘DESC′;break;case′3′:order = ' `inputtime` ASC ';
break;
case '4':
order=′‘inputtime‘DESC′;break;case′5′:order = ' `inputtime` DESC ';
break;
case '5':order=′‘inputtime‘DESC′;break;case′5′:order = ' `updatetime` ASC ';
break;
case '6':
order=′‘updatetime‘DESC′;break;default:order = ' `updatetime` DESC ';
break;
default:order=′‘updatetime‘DESC′;break;default:order = ' `id` DESC ';
}
if(ParseError: KaTeX parse error: Expected '}', got 'EOF' at end of input: data['catid']){catids = explode(',', data[′catid′]);foreach(data['catid']);
foreach(data[′catid′]);foreach(catids as ParseError: KaTeX parse error: Expected '}', got 'EOF' at end of input: catid){catid = intval(catid);if(empty(catid);
if(empty(catid);if(empty(catid))continue;
this−>setmodelid(this->set_modelid(this−>setmodelid(catid);
where=where =where=this->category[catid][′child′]?′‘catid‘IN(′.catid]['child'] ? ' `catid` IN ('.catid][′child′]?′‘catid‘IN(′.this->category[catid][′arrchildid′].′)′:"‘catid‘=catid]['arrchildid'].')' : " `catid` =catid][′arrchildid′].′)′:"‘catid‘=catid";
datas=datas =datas=this->db->select(where,′∗′,where, '*',where,′∗′,num, order);order);order);data[catid][′data′]=catid]['data'] =catid][′data′]=datas;
// 记录本次的文章数
data[′num′][]=count(data['num'][] = count(data[′num′][]=count(datas);
ParseError: KaTeX parse error: Expected 'EOF', got '}' at position 18: …del_num++;
}̲
}else{models = getcache('model', 'commons');
foreach(modelsasmodels asmodelsasmodel){
this−>db−>setmodel(this->db->set_model(this−>db−>setmodel(model['modelid']);
datas=datas =datas=this->db->select('', '*', num,num,num,order);
data[data[data[model['modelid']]['data'] = datas;//记录本次的文章数datas;
// 记录本次的文章数datas;//记录本次的文章数data['num'][] = count(datas);datas);datas);model_num++;
}
}
if(ParseError: KaTeX parse error: Expected '}', got 'EOF' at end of input: …/ 获取每个模型应该截取的条数num = ceil(num/num/num/model_num);
// 循环条数记录用于找出条数不满足的数量然后进行平均
wnum=w_num =wnum=w_num_t = '';
foreach(data[′num′]asdata['num'] asdata[′num′]asnum_t){
if(numt<num_t<numt<num){
wnum+=w_num +=wnum+=num-numt;num_t;numt;w_num_t++;
}
}
// 判断是否有不满足平均数的 如果有那么就增加平均值
if(ParseError: KaTeX parse error: Expected '}', got 'EOF' at end of input: w_num_t){num += ceil(wnum/(w_num/(wnum/(model_num-ParseError: KaTeX parse error: Expected 'EOF', got '}' at position 16: w_num_t));
}̲datas = array();
foreach(dataasdata asdataasr){
rn=′′;if(isarray(r_n = '';
if(is_array(rn=′′;if(isarray(r['data']))
foreach(r[′data′]asr['data'] asr[′data′]asr_t){
datas[]=datas[] =datas[]=r_t;
if(++rn==r_n ==rn==num)break;
}
}
return $datas;
}else{
return false;
}
}
第二步:模板调用 、
其实就和默认的文章列表调用差不多
{pc:content action=”newcontent” catid=”1″ num=”24″ order=”1″}
参数说明:
catid:可有可无 加了就只调用指定栏目的信息 多个栏目请使用英文半角的 ,间隔
order:排序 参数值:1-7 具体的含义在代码里面很容易看明白 不祥述
num:调用数量 不指定默认调用20条