caching = true; $smarty->cache_lifetime = 360000; if (!$smarty->is_cached('juview.html',$url)) { $sql = "SELECT * FROM `vab_ju` where id = $id"; $juinfo = $GLOBALS['db']->getRow($sql); if($juinfo['title'] ==''){ $smarty->assign('err','您指定的数据没有找到!'); $smarty->display('err.html'); exit; } $gid = $juinfo['gid']; $sql = "SELECT * FROM `vab_shiwen` where id = $gid"; $nrinfo = $GLOBALS['db']->getRow($sql); $nrinfo['url'] = $_SERVER['REQUEST_URI']; //标题加红 $juinfo['title'] = trim($juinfo['title']); $nrinfo['body'] = str_replace($juinfo['title'],''.$juinfo['title'].'',$nrinfo['body']); //调用拼音程序 include WEBROOT.'/ChinesePinyin.class.php'; $Pinyin = new ChinesePinyin(); $nrinfo['pinyinbody'] = $Pinyin->TransformWithTone($nrinfo['body']); $nrinfo['zid'] = get_one_biao_info('writer','id'," name='$nrinfo[zuozhe]'");; $nrinfo['chaoid'] = get_one_biao_info('chaodai','id'," name='$nrinfo[chaodai]'"); if($nrinfo['chaoid'] ==''){ $nrinfo['chaoid'] = 0; } if($nrinfo['zid'] ==''){ $nrinfo['zid'] = 0; } $nrinfo['info'] = strip_tags($nrinfo['body']); $smarty->assign('juinfo', $juinfo); $smarty->assign("nrinfo",$nrinfo); //获取相关翻译 $fanyi_list = get_fujia_list($gid,1); //获取相关赏析 $shangxi_list = get_fujia_list($gid,2); $smarty->assign('shangxi_list', $shangxi_list); //赏析列表 $smarty->assign('fanyi_list', $fanyi_list); //翻译列表 //调用作者资料 $zuozhe_info = get_zuozhe_info($nrinfo['zid']); $smarty->assign('zuozhe_info', $zuozhe_info); //获取所有分类 if($juinfo['type']){ $type_list = array(); $arr = explode ("|",$juinfo['type']); foreach($arr as $k=> $v){ $name = trim($v); if($name){ $vv = get_jutype_info($name); $type_list[$k] = $vv; } } } $smarty->assign('type_list', $type_list); //调用热门诗人 $smarty->assign('hotshiren', get_all_biao_info('writer','id,name,dynasty',"ifcheck > 0 and dynasty='$nrinfo[chaodai]'",'rand()','limit 10')); $smarty->assign('hotshiwen', get_all_biao_info('shiwen','id,title,zuozhe',"ifcheck > 0 and zuozhe='$nrinfo[zuozhe]'",'rand()','limit 10')); $smarty->assign('hotmingju', get_all_biao_info('ju','id,title','ifcheck > 0','rand()','limit 5')); $smarty->assign('hotchengyu', get_all_biao_info('chengyu','id,title,pinyin','ifcheck > 0','rand()','limit 5')); } $smarty->display('juview.html',$url);//设置缓存文件名 ?>