userfun里的函数如下:
function user_show_tags($tbname,$classid,$num){ global $empire,$dbtbpre;
if (empty($tbname)){ $tbname="news"; } if (!empty($classid)){ $where=" where classid=".$classid; }else{ $where=""; } $sql=$empire->query("select keyboard from {$dbtbpre}ecms_{$tbname}".$where);
while ($r = $empire->fetch ($sql)){ if ($r[keyboard]){ $keyboard.=','.$r[keyboard]; } }
$keyboard=trim($keyboard,','); $array=explode(',',$keyboard); $count=array_count_values($array); arsort($count,SORT_NUMERIC); foreach($count as $key=>$val){ $string=$string.$key.","; } $string=trim($string,','); $tagstring=explode(',',$string); if($num<=count($tagstring)){ $tagsnum=$num; }else{ $tagsnum=count($tagstring); } for ($j=0;$j<$tagsnum;$j++){ echo "<a href=/search/keyword/?show=title&classid=0&keyboard=".$tagstring[$j].">".$tagstring[$j]."</a> "; }
}
调用格式: [showtags]调用表名,栏目ID,Tags数量[/showtags]
[showtags]news,1,30[/showtags]
请大家在标签管理里自已加一下
解决调用多个标签时刷新出错问题,可调用自己指定的栏目~
上传以下图片:
|