caching=true; //配置缓存的生命周期 //$smarty->cache_lifetime=3600;//单位是秒 $file =SVR_ROOT . $_SERVER["REQUEST_URI"]; if(substr($file, strlen($file) - 1, 1)=='/'){ $file=$file.'index.html'; } if (file_exists($file)) { if(!is_dir($file)){ exit(file_get_contents($file)); } } include SVR_INC.'/smarty/plugins/smarty_block_arclist.php'; $smarty->registerPlugin("block","arclist", "smarty_block_arclist"); $host=$_SERVER['SERVER_NAME']; $domain_arr=explode('.', $host); $domain=$domain_arr[0]; //exit($domain); require_once SVRDATA."/config.cache.inc.php"; //print_r($cfgs_site); if(hadSite($domain)){ $arr=$fun->getarr("area", "*", "where sign='$domain'"); if(!empty($arr["title"])){ $cfgs_site["site_title"]=$arr["title"]; }else{ $cfgs_site["site_title"]=$arr["name"].$cfgs_site["site_title"]; } if(!empty($arr["kwd"])){ $cfgs_site["site_kwd"]=$arr["kwd"]; } if(!empty($arr["intro"])){ $cfgs_site["site_intro"]=$arr["intro"]; }else{ $cfgs_site["site_intro"]=$arr["name"].$cfgs_site["site_intro"]; } if(!empty($arr["name"])){ $cfgs_site["area"]=$arr["name"]; } } $smarty->assign('site',$cfgs_site); if(is_mobile()){ $tpl_num=$cfgs_site['site_m_style']; }else{ $tpl_num=$cfgs_site['site_d_style']; } $tpl_path=SVR_ROOT."/$tpl_num/"; $cfgs_site['site_style']=$tpl_num; $smarty->setTemplateDir($tpl_path); if(!empty($aid)&&!empty($c)){ //exit('body'); //exit('aid='.$aid); $cate_arr=$fun->getarr('cate', 'id,cate_name,cate_sign,cate_kwd,cate_intro,list_tpl,show_tpl,cate_type', "where cate_sign='$c'"); //print_r($cate_arr); $tid=$cate_arr['id']; $ca=$fun->query('cate', "id,cate_name,cate_sign,fid", "", "", ""); $pos=postree($ca,$tid); //print_r($pos); $smarty->assign('pos',$pos); $smarty->assign('cate',$cate_arr); $arr=$fun->getarr('arc', '*', "where id=$aid"); $arr['pre']=$fun->next(-1, $aid); $arr['next']=$fun->next(1, $aid); //print_r($arr); $smarty->assign('arr',$arr); if(!empty($cate_arr['show_tpl'])){ $smarty->display($cate_arr['show_tpl']); }else{ $smarty->display($cate_arr['cate_type'].'_show.tpl'); } }elseif(empty($aid)&&!empty($c)){ //exit('list'); $cate_arr=$fun->getarr('cate', 'id,cate_name,cate_title,cate_sign,cate_kwd,cate_intro,list_tpl,show_tpl,cate_type,body', "where cate_sign='$c'"); $smarty->assign('cate',$cate_arr); //print_r($cate_arr); //$list=$fun->query("arc", "id,title,kwd,cate_sign,intro,litpic", " flag=1 and cate_sign='$c'", "adtime", ""); $tid=$cate_arr["id"]; $ca=$fun->query('cate', "id,cate_name,cate_sign,fid", "", "", ""); $pos=postree($ca,$tid); //print_r($pos); $smarty->assign('pos',$pos); include_once SVR_INC.'/page.class.php'; if($tid){ $sql="select * from tb_arc where flag=1 and (cate_sign='$c' or cate_sign in (select cate_sign from tb_cate where fid=$tid)) order by adtime desc"; $count=$db->num_rows($sql); $page = new page(); $list = $page->getData($sql,$db,16,0); $smarty->assign('pageList',$page->pagelist("/$c-{page}.html")); }else{ $sql="select * from tb_arc where flag=1 order by adtime desc"; $count=$db->num_rows($sql); $page = new page(); $list = $page->getData($sql,$db,16,0); $smarty->assign('pageList',$page->pagelist("/$c-{page}.html")); } //print_r($list); $smarty->assign("vo",$list); if(!empty($cate_arr['list_tpl'])){ $smarty->display($cate_arr['list_tpl']); }else{ $smarty->display($cate_arr['cate_type'].'_list.tpl'); } }else{ //exit('index'); switch ($m){ case 'map':{ $lst=array(); $index=0; $cate=$fun->query("cate", "id,cate_sign,cate_name", "flag=1", "rank asc", ""); foreach ($cate as $key=>$val){ $lst[$index]["url"]=$cfgs_site["site_http"]."$host/".$val["cate_sign"].".html"; $lst[$index]["title"]=$val["cate_name"]; $index++; } $arcs=$fun->query("arc", "id,title,cate_sign,adtime", "flag=1", "", ""); foreach ($arcs as $key=>$val){ $lst[$index]["url"]=$cfgs_site["site_http"]."$host/".$val["cate_sign"]."/".$val["id"].".html"; $lst[$index]["title"]=$val["title"]; $index++; } $smarty->assign("vo",$lst); $smarty->display("sitemap.tpl"); break; } case 'area':{ $lst=array(); $index=0; $area=$fun->query("area", "id,name,sign,title", "flag=1", "rank asc", ""); foreach ($area as $key=>$val){ $lst[$index]["url"]=$cfgs_site["site_http"].$val["sign"].".".$cfgs_site["site_host"]; $lst[$index]["name"]=$val["name"]; $lst[$index]["title"]=$val["title"]; $index++; } $smarty->assign("vo",$lst); $smarty->display("area_list.tpl"); break; } default:{ $smarty->display('index.tpl'); } } }