tpl_vars['plist'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['plist']->_loop = false;
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
global $db,$db_config,$config;
include PLUS_PATH.'/group.cache.php';$plist= array();
$rs = null;
$nids = null;
$paramer = array("item"=>"'plist'","type"=>"'t'","pic"=>"1","urlstatic"=>"1","t_len"=>"20","limit"=>"2","key"=>"'key'","name"=>"'newlistpic'","nocache"=>"")
;
$ParamerArr = GetSmarty($paramer,$_GET,$_smarty_tpl);
$paramer = $ParamerArr['arr'];
$Purl = $ParamerArr['purl'];
if($paramer[cache]){
$Purl = "{{page}}.html";
}
global $ModuleName;
if(!$Purl["m"]){
$Purl["m"]=$ModuleName;
}
$where=1;
$where .=" and (`starttime`<=".time()." or `starttime`=0 or `starttime` is null)";
$where .=" and (`endtime`>".time()." or `endtime`=0 or `endtime` is null)";
if($config['did']){
$where .= " and (`did`='".$config['did']."' or `did`=-1)";
}else{
$where .= " and (`did`=-1 OR `did`=0 OR did='')";
}
include PLUS_PATH."/group.cache.php";
if($paramer['nid']){
$nid_s = @explode(',',$paramer[nid]);
foreach($nid_s as $v){
if($group_type[$v]){
$paramer[nid] = $paramer[nid].",".@implode(',',$group_type[$v]);
}
}
}
if($paramer['nid']!="" && $paramer['nid']!=0){
$where .=" AND `nid` in ($paramer[nid])";
$nids = @explode(',',$paramer['nid']);
$paramer['nid']=$paramer['nid'];
}else if($paramer['rec']!=""){
$nids=array();
if(is_array($group_rec)){
foreach($group_rec as $key=>$value){
if($key<=2){
$nids[]=$value;
}
}
$paramer[nid]=@implode(',',$nids);
}
}
if($paramer['type']){
$type = str_replace("\"","",$paramer[type]);
$type_arr = @explode(",",$type);
if(is_array($type_arr) && !empty($type_arr)){
foreach($type_arr as $key=>$value){
$where .=" AND FIND_IN_SET('".$value."',`describe`)";
if(count($nids)>0){
$picwhere .=" AND FIND_IN_SET('".$value."',`describe`)";
}
}
}
}
//拼接补充SQL条件
if($paramer['pic']!=""){
$where .=" AND `newsphoto`<>''";
}
//新闻搜索
if($paramer['keyword']!=""){
$where .=" AND `title` LIKE '%".$paramer[keyword]."%'";
}
//拼接查询条数
if(intval($paramer['limit'])>0){
$limit = intval($paramer['limit']);
$limit = " limit ".$limit;
}
if($paramer['ispage']){
if($Purl["m"]=="wap"){
$limit = PageNav($paramer,$_GET,"news_base",$where,$Purl,"","6",$_smarty_tpl);
}else{
$limit = PageNav($paramer,$_GET,"news_base",$where,$Purl,"","5",$_smarty_tpl);
}
}
//拼接字段排序
if($paramer['order']!=""){
$where .=" ORDER BY $paramer[order]";
}else{
$where .=" ORDER BY `starttime`";
}
//排序方式默认倒序
if($paramer['sort']){
$where.=" ".$paramer[sort];
}else{
$where.=" DESC";
}
//多类别新闻查找
if(!intval($paramer['ispage']) && count($nids)>0){
$nidArr = @explode(',',$paramer[nid]);
$rsnids = array();
if(is_array($group_type)){
foreach($group_type as $key=>$value){
if(in_array($key,$nidArr)){
if(is_array($value)){
foreach($value as $v){
$rsnids[$v] = $key;
$nidArr[] = $v;
}
}
}
}
}
$where = " `nid` IN (".@implode(',',$nidArr).")";
if($config['did']){
$where.=" and `did`='".$config['did']."'";
}
//查询带图新闻
if($paramer['pic']){
if(!$paramer['piclimit']){
$piclimit = 1;
}else{
$piclimit = $paramer['piclimit'];
}
$db->query("set @f=0,@n=0");
$query = $db->query("select * from (select id,title,color,datetime,starttime,description,newsphoto,@n:=if(@f=nid,@n:=@n+1,1) as aid,@f:=nid as nid from $db_config[def]news_base WHERE ".$where." AND `newsphoto` <>'' order by nid asc,starttime desc) a where aid <=".$piclimit);
$conque = $db->select_all("news_content","1 order by nbid desc".$limit);
foreach($conque as $cv){
$newcon[$cv[nbid]]=$cv;
}
while($rs = $db->fetch_array($query)){
if($rsnids[$rs['nid']]){
$rs['nid'] = $rsnids[$rs['nid']];
}
//处理标题长度
if(intval($paramer[t_len])>0){
$len = intval($paramer[t_len]);
$rs[title_n] = $rs[title];
$rs[title] = mb_substr($rs[title],0,$len,"utf-8");
}
if($rs[color]){
$rs[title] = "
".$rs[title]."";
}
//处理描述内容长度
if(intval($paramer[d_len])>0){
$len = intval($paramer[d_len]);
$rs[description] = mb_substr($rs[description],0,$len,"utf-8");
}
$rs['name'] = $group_name[$rs['nid']];
//构建资讯静态链接
if($config[sy_news_rewrite]=="2"){
$rs["url"]=$config['sy_weburl']."/news/".date("Ymd",$rs["datetime"])."/".$rs[id].".html";
}else{
$rs["url"] = Url("article",array("c"=>"show","id"=>$rs[id]),"1");
}
if(mb_substr($rs[newsphoto],0,4)=="http"){
$rs["picurl"]=$rs[newsphoto];
}else{
if($rs['newsphoto']==""){
$content=str_replace(array('"',"'"),array("",""),$newcon[$rs[id]]["content"]);
preg_match_all("/
![]()
]+src=(.*?)\s[^>]+>/im",$content,$res);
$str=str_replace("\\","",$res[1][0]);
if($str){
$rs[newsphoto]=".".$str;
}
}
$nopic=$config[sy_weburl]."/app/template/".$config[style]."/images/nopic.gif";
$rs["picurl"] = checkpic($rs['newsphoto'],$nopic);
}
$rs[time]=date("Y-m-d",$rs[starttime]);
$rs['starttime']=date("m-d",$rs[starttime]);
if(count($plist[$rs['nid']]['pic'])<$piclimit){
$plist[$rs['nid']]['pic'][] = $rs;
}
}//end while
}
$db->query("set @f=0,@n=0");
$query = $db->query("select * from (select id,title,datetime,starttime,color,description,newsphoto,@n:=if(@f=nid,@n:=@n+1,1) as aid,@f:=nid as nid from $db_config[def]news_base WHERE ".$where." order by nid asc,starttime desc) a where aid <=$paramer[limit]");
while($rs = $db->fetch_array($query)){
if($rsnids[$rs['nid']]){
$rs['nid'] = $rsnids[$rs['nid']];
}
//处理标题长度
if(intval($paramer[t_len])>0){
$len = intval($paramer[t_len]);
$rs[title_n] = $rs[title];
$rs[title] = mb_substr($rs[title],0,$len,"utf-8");
}
if($rs[color]){
$rs[title] = "
".$rs[title]."";
}
//处理描述内容长度
if(intval($paramer[d_len])>0){
$len = intval($paramer[d_len]);
$rs[description] = mb_substr($rs[description],0,$len,"utf-8");
}
//获取所属类别名称
$rs['name'] = $group_name[$rs['nid']];
//构建资讯静态链接
if($config[sy_news_rewrite]=="2"){
$rs["url"]=$config['sy_weburl']."/news/".date("Ymd",$rs["datetime"])."/".$rs[id].".html";
}else{
$rs["url"] = Url("article",array("c"=>"show","id"=>$rs[id]),"1");
}
if(mb_substr($rs[newsphoto],0,4)=="http"){
$rs["picurl"]=$rs[newsphoto];
}else{
if($rs['newsphoto']==""){
$rs["picurl"] = $config[sy_weburl]."/app/template/".$config[style]."/images/nopic.gif";
}else{
$rs["picurl"] = checkpic($rs['newsphoto']);
}
}
$rs[time]=date("Y-m-d",$rs[starttime]);
$rs[starttime]=date("m-d",$rs[starttime]);
if(count($plist[$rs['nid']]['arclist'])<$paramer[limit]){
$plist[$rs['nid']]['arclist'][] = $rs;
}
}//end while
}//end if(!intval($paramer['ispage']) && count($nids)>0)
else{
$query = $db->query("SELECT * FROM `$db_config[def]news_base` WHERE ".$where.$limit);
while($rs = $db->fetch_array($query)){
//处理标题长度
if(intval($paramer[t_len])>0){
$len = intval($paramer[t_len]);
$rs[title_n] = $rs[title];
$rs[title] = mb_substr($rs[title],0,$len,"utf-8");
}
if($rs[color]){
$rs[title] = "
".$rs[title]."";
}
//处理描述内容长度
if(intval($paramer[d_len])>0){
$len = intval($paramer[d_len]);
$rs[description] = mb_substr($rs[description],0,$len,"utf-8");
}
//获取所属类别名称
$rs['name'] = $group_name[$rs['nid']];
//构建资讯静态链接
if($config[sy_news_rewrite]=="2"){
$rs["url"]=$config['sy_weburl']."/news/".date("Ymd",$rs["datetime"])."/".$rs[id].".html";
}else{
$rs["url"] = Url("article",array("c"=>"show","id"=>$rs[id]),"1");
}
if(mb_substr($rs[newsphoto],0,4)=="http"){
$rs["picurl"]=$rs[newsphoto];
}else{
if($rs['newsphoto']==""){
$rs["picurl"] = $config[sy_weburl]."/app/template/".$config[style]."/images/nopic.gif";
}else{
$rs["picurl"] = checkpic($rs['newsphoto']);
}
}
$rs[time]=date("Y-m-d",$rs[starttime]);
$rs[starttime]=date("m-d",$rs[starttime]);
$plist[] = $rs;
}//end while
}$plist = $plist; if (!is_array($plist) && !is_object($plist)) { settype($plist, 'array');}
foreach ($plist as $_smarty_tpl->tpl_vars['plist']->key => $_smarty_tpl->tpl_vars['plist']->value) {
$_smarty_tpl->tpl_vars['plist']->_loop = true;
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['plist']->key;
?>

value;?>
/images/lay-loding.png' lay-src="tpl_vars['plist']->value['picurl'];?>
" width="190" height="120" alt="tpl_vars['plist']->value['title_n'];?>
">
tpl_vars['plist']->value['name'];?>
tpl_vars['plist']->value['time'];?>
tpl_vars['nlist'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['nlist']->_loop = false;
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
global $db,$db_config,$config;
include PLUS_PATH.'/group.cache.php';$nlist= array();
$rs = null;
$nids = null;
$paramer = array("item"=>"'nlist'","t_len"=>"20","limit"=>"14","key"=>"'key'","name"=>"'newlist'","nocache"=>"")
;
$ParamerArr = GetSmarty($paramer,$_GET,$_smarty_tpl);
$paramer = $ParamerArr['arr'];
$Purl = $ParamerArr['purl'];
if($paramer[cache]){
$Purl = "{{page}}.html";
}
global $ModuleName;
if(!$Purl["m"]){
$Purl["m"]=$ModuleName;
}
$where=1;
$where .=" and (`starttime`<=".time()." or `starttime`=0 or `starttime` is null)";
$where .=" and (`endtime`>".time()." or `endtime`=0 or `endtime` is null)";
if($config['did']){
$where .= " and (`did`='".$config['did']."' or `did`=-1)";
}else{
$where .= " and (`did`=-1 OR `did`=0 OR did='')";
}
include PLUS_PATH."/group.cache.php";
if($paramer['nid']){
$nid_s = @explode(',',$paramer[nid]);
foreach($nid_s as $v){
if($group_type[$v]){
$paramer[nid] = $paramer[nid].",".@implode(',',$group_type[$v]);
}
}
}
if($paramer['nid']!="" && $paramer['nid']!=0){
$where .=" AND `nid` in ($paramer[nid])";
$nids = @explode(',',$paramer['nid']);
$paramer['nid']=$paramer['nid'];
}else if($paramer['rec']!=""){
$nids=array();
if(is_array($group_rec)){
foreach($group_rec as $key=>$value){
if($key<=2){
$nids[]=$value;
}
}
$paramer[nid]=@implode(',',$nids);
}
}
if($paramer['type']){
$type = str_replace("\"","",$paramer[type]);
$type_arr = @explode(",",$type);
if(is_array($type_arr) && !empty($type_arr)){
foreach($type_arr as $key=>$value){
$where .=" AND FIND_IN_SET('".$value."',`describe`)";
if(count($nids)>0){
$picwhere .=" AND FIND_IN_SET('".$value."',`describe`)";
}
}
}
}
//拼接补充SQL条件
if($paramer['pic']!=""){
$where .=" AND `newsphoto`<>''";
}
//新闻搜索
if($paramer['keyword']!=""){
$where .=" AND `title` LIKE '%".$paramer[keyword]."%'";
}
//拼接查询条数
if(intval($paramer['limit'])>0){
$limit = intval($paramer['limit']);
$limit = " limit ".$limit;
}
if($paramer['ispage']){
if($Purl["m"]=="wap"){
$limit = PageNav($paramer,$_GET,"news_base",$where,$Purl,"","6",$_smarty_tpl);
}else{
$limit = PageNav($paramer,$_GET,"news_base",$where,$Purl,"","5",$_smarty_tpl);
}
}
//拼接字段排序
if($paramer['order']!=""){
$where .=" ORDER BY $paramer[order]";
}else{
$where .=" ORDER BY `starttime`";
}
//排序方式默认倒序
if($paramer['sort']){
$where.=" ".$paramer[sort];
}else{
$where.=" DESC";
}
//多类别新闻查找
if(!intval($paramer['ispage']) && count($nids)>0){
$nidArr = @explode(',',$paramer[nid]);
$rsnids = array();
if(is_array($group_type)){
foreach($group_type as $key=>$value){
if(in_array($key,$nidArr)){
if(is_array($value)){
foreach($value as $v){
$rsnids[$v] = $key;
$nidArr[] = $v;
}
}
}
}
}
$where = " `nid` IN (".@implode(',',$nidArr).")";
if($config['did']){
$where.=" and `did`='".$config['did']."'";
}
//查询带图新闻
if($paramer['pic']){
if(!$paramer['piclimit']){
$piclimit = 1;
}else{
$piclimit = $paramer['piclimit'];
}
$db->query("set @f=0,@n=0");
$query = $db->query("select * from (select id,title,color,datetime,starttime,description,newsphoto,@n:=if(@f=nid,@n:=@n+1,1) as aid,@f:=nid as nid from $db_config[def]news_base WHERE ".$where." AND `newsphoto` <>'' order by nid asc,starttime desc) a where aid <=".$piclimit);
$conque = $db->select_all("news_content","1 order by nbid desc".$limit);
foreach($conque as $cv){
$newcon[$cv[nbid]]=$cv;
}
while($rs = $db->fetch_array($query)){
if($rsnids[$rs['nid']]){
$rs['nid'] = $rsnids[$rs['nid']];
}
//处理标题长度
if(intval($paramer[t_len])>0){
$len = intval($paramer[t_len]);
$rs[title_n] = $rs[title];
$rs[title] = mb_substr($rs[title],0,$len,"utf-8");
}
if($rs[color]){
$rs[title] = "".$rs[title]."";
}
//处理描述内容长度
if(intval($paramer[d_len])>0){
$len = intval($paramer[d_len]);
$rs[description] = mb_substr($rs[description],0,$len,"utf-8");
}
$rs['name'] = $group_name[$rs['nid']];
//构建资讯静态链接
if($config[sy_news_rewrite]=="2"){
$rs["url"]=$config['sy_weburl']."/news/".date("Ymd",$rs["datetime"])."/".$rs[id].".html";
}else{
$rs["url"] = Url("article",array("c"=>"show","id"=>$rs[id]),"1");
}
if(mb_substr($rs[newsphoto],0,4)=="http"){
$rs["picurl"]=$rs[newsphoto];
}else{
if($rs['newsphoto']==""){
$content=str_replace(array('"',"'"),array("",""),$newcon[$rs[id]]["content"]);
preg_match_all("/
]+src=(.*?)\s[^>]+>/im",$content,$res);
$str=str_replace("\\","",$res[1][0]);
if($str){
$rs[newsphoto]=".".$str;
}
}
$nopic=$config[sy_weburl]."/app/template/".$config[style]."/images/nopic.gif";
$rs["picurl"] = checkpic($rs['newsphoto'],$nopic);
}
$rs[time]=date("Y-m-d",$rs[starttime]);
$rs['starttime']=date("m-d",$rs[starttime]);
if(count($nlist[$rs['nid']]['pic'])<$piclimit){
$nlist[$rs['nid']]['pic'][] = $rs;
}
}//end while
}
$db->query("set @f=0,@n=0");
$query = $db->query("select * from (select id,title,datetime,starttime,color,description,newsphoto,@n:=if(@f=nid,@n:=@n+1,1) as aid,@f:=nid as nid from $db_config[def]news_base WHERE ".$where." order by nid asc,starttime desc) a where aid <=$paramer[limit]");
while($rs = $db->fetch_array($query)){
if($rsnids[$rs['nid']]){
$rs['nid'] = $rsnids[$rs['nid']];
}
//处理标题长度
if(intval($paramer[t_len])>0){
$len = intval($paramer[t_len]);
$rs[title_n] = $rs[title];
$rs[title] = mb_substr($rs[title],0,$len,"utf-8");
}
if($rs[color]){
$rs[title] = "".$rs[title]."";
}
//处理描述内容长度
if(intval($paramer[d_len])>0){
$len = intval($paramer[d_len]);
$rs[description] = mb_substr($rs[description],0,$len,"utf-8");
}
//获取所属类别名称
$rs['name'] = $group_name[$rs['nid']];
//构建资讯静态链接
if($config[sy_news_rewrite]=="2"){
$rs["url"]=$config['sy_weburl']."/news/".date("Ymd",$rs["datetime"])."/".$rs[id].".html";
}else{
$rs["url"] = Url("article",array("c"=>"show","id"=>$rs[id]),"1");
}
if(mb_substr($rs[newsphoto],0,4)=="http"){
$rs["picurl"]=$rs[newsphoto];
}else{
if($rs['newsphoto']==""){
$rs["picurl"] = $config[sy_weburl]."/app/template/".$config[style]."/images/nopic.gif";
}else{
$rs["picurl"] = checkpic($rs['newsphoto']);
}
}
$rs[time]=date("Y-m-d",$rs[starttime]);
$rs[starttime]=date("m-d",$rs[starttime]);
if(count($nlist[$rs['nid']]['arclist'])<$paramer[limit]){
$nlist[$rs['nid']]['arclist'][] = $rs;
}
}//end while
}//end if(!intval($paramer['ispage']) && count($nids)>0)
else{
$query = $db->query("SELECT * FROM `$db_config[def]news_base` WHERE ".$where.$limit);
while($rs = $db->fetch_array($query)){
//处理标题长度
if(intval($paramer[t_len])>0){
$len = intval($paramer[t_len]);
$rs[title_n] = $rs[title];
$rs[title] = mb_substr($rs[title],0,$len,"utf-8");
}
if($rs[color]){
$rs[title] = "".$rs[title]."";
}
//处理描述内容长度
if(intval($paramer[d_len])>0){
$len = intval($paramer[d_len]);
$rs[description] = mb_substr($rs[description],0,$len,"utf-8");
}
//获取所属类别名称
$rs['name'] = $group_name[$rs['nid']];
//构建资讯静态链接
if($config[sy_news_rewrite]=="2"){
$rs["url"]=$config['sy_weburl']."/news/".date("Ymd",$rs["datetime"])."/".$rs[id].".html";
}else{
$rs["url"] = Url("article",array("c"=>"show","id"=>$rs[id]),"1");
}
if(mb_substr($rs[newsphoto],0,4)=="http"){
$rs["picurl"]=$rs[newsphoto];
}else{
if($rs['newsphoto']==""){
$rs["picurl"] = $config[sy_weburl]."/app/template/".$config[style]."/images/nopic.gif";
}else{
$rs["picurl"] = checkpic($rs['newsphoto']);
}
}
$rs[time]=date("Y-m-d",$rs[starttime]);
$rs[starttime]=date("m-d",$rs[starttime]);
$nlist[] = $rs;
}//end while
}$nlist = $nlist; if (!is_array($nlist) && !is_object($nlist)) { settype($nlist, 'array');}
foreach ($nlist as $_smarty_tpl->tpl_vars['nlist']->key => $_smarty_tpl->tpl_vars['nlist']->value) {
$_smarty_tpl->tpl_vars['nlist']->_loop = true;
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['nlist']->key;
?>
-
tpl_vars['nlist']->value['title'];?>
tpl_vars['nlist']->value['time'];?>