<?php
if(!defined('IN_MYMPS')) exit('FORBIDDEN');
runcron();
$catid = isset($catid) ? intval($catid) : 0;//初始化catid
$channel = get_cat_info($catid,'channel');
if(!$channel) write_msg('您所指定的新闻栏目不存在或者已经删除！');//获得当前栏目的相关信息

$loc		= get_location('channel',$catid);//获得页面标题
$location	= $loc['location'];
$page_title	= $loc['page_title'];

$seo		= get_seoset();
$rewrite 	= $seo['seo_force_news'];

$cat_children	= get_cat_children($catid,'channel');

$param = setParam(array('catid'),$rewrite,'news-',$seo['seo_htmldir'].$seo['seo_htmlnewsdir'].$channel['html_dir']);
$rows_num = $db->getOne("SELECT COUNT(*) FROM `{$db_mymps}news` AS a WHERE catid IN($cat_children)");
$page1 = page1("SELECT * FROM {$db_mymps}news WHERE catid IN($cat_children) ORDER BY begintime DESC",$mymps_global['cfg_list_page_line']?$mymps_global['cfg_list_page_line']:25);
foreach($page1 as $kr => $r){
	$arr['begintime']   = $r['begintime'];
	$arr['hit']  		= $r['hit'];
	$arr['title']  	    = $r['title'];
	$arr['iscommend']  	= $r['iscommend'];
	$arr['content'] 	= clear_html($r['content']);
	$arr['uri']	  	  	= $r['isjump'] ? $r['redirect_url'] : Rewrite('news',array('id'=>$r['id'],'html_path'=>$r['html_path']));
	$arr['imgpath'] 	= $r['imgpath'];
	$news[]			  	= $arr;
}

$advertisement			= get_advertisement('other');//获得全局广告
$adveritems				= $advertisement['items'];
$advertisement			= $advertisement['all'];

tpl_assign();
$smarty->assign('news',$news);
$smarty->assign('channel',$channel);
$smarty -> assign('cat_list',get_categories_tree(empty($channel['parentid']) ? $catid : $channel['parentid'],'channel'));//获得同类栏目
$smarty->assign('latest_info',mymps_get_info_list(10,'','','','','','','',false));
$smarty->assign('latest_news',mymps_get_news_list(15,false));//取得最新发布的10条新闻
$smarty->assign('image_news',mymps_get_news_list(6,'',1,false));//取得最新的6条图文新闻;
$smarty->assign('pageview',page2($rewrite));
$smarty->assign('cat',NULL);
$news = $channel = $page_title = $cat_children = $location = $page1 = $cat_list = $area_list = $advertisement = $cat = $adveritems = NULL;
?>