织梦火车采集器采集完文章并更新栏目页、首页、上下篇的方法
打开文件 /dede/inc/inc_archives_functions.php
1、在最后增加方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
/*火车头采集自动更新主页*/ function MakeIndex() { global $dsql,$cfg_basedir,$cfg_templets_dir,$cfg_df_style; require_once(DEDEINC.'/arc.partview.class.php'); $envs = $_sys_globals = array(); $envs['aid'] = 0; $pv = new PartView(); $row = $pv->dsql->GetOne('SELECT * FROM `dede_homepageset`'); $templet = str_replace("{style}", $cfg_df_style, $row['templet']); $homeFile = dirname(__FILE__).'/../'.$row['position']; $homeFile = str_replace("//", "/", str_replace("//", "/", $homeFile)); $fp = fopen($homeFile, 'w') or die("无法更新网站主页到:$homeFile 位置"); fclose($fp); $tpl = $cfg_basedir.$cfg_templets_dir.'/'.$templet; if(!file_exists($tpl)) { $tpl = $cfg_basedir.$cfg_templets_dir.'/default/index.htm'; if(!file_exists($tpl)) exit("无法找到主页模板:$tpl "); } $GLOBALS['_arclistEnv'] = 'index'; $pv->SetTemplet($tpl); $pv->SaveToHtml($homeFile); $pv->Close(); } /*火车头采集自动更新栏目*/ function MakeParentType($typeid) { global $dsql; $typediarr = array(); array_push($typediarr,$typeid); $row3 = $dsql->GetOne("Select reid,topid From `dede_arctype` where id=".$typeid); if(!in_array($row3['reid'],$typediarr) and $row3['reid']!=0) array_push($typediarr,$row3['reid']); if(!in_array($row3['topid'],$typediarr) and $row3['topid']!=0) array_push($typediarr,$row3['topid']); require_once(DEDEDATA."/cache/inc_catalog_base.inc"); require_once(DEDEINC."/channelunit.func.php"); require_once(DEDEINC."/arc.listview.class.php"); foreach($typediarr as $typeid) { $lv = new ListView($typeid); $lv->MakeHtml(1,$maxpagesize); } } /*火车头采集自动更新上下篇*/ function MakePreNext($aid,$typeid) { global $dsql; require_once(DEDEINC.'/arc.archives.class.php'); $aid = intval($aid); $preRow = $dsql->GetOne("SELECT id FROM `dede_arctiny` WHERE id<$aid AND arcrank>-1 AND typeid='$typeid' ORDER BY id DESC"); $nextRow = $dsql->GetOne("SELECT id FROM `dede_arctiny` WHERE id>$aid AND arcrank>-1 AND typeid='$typeid' ORDER BY id ASC"); if(is_array($preRow)) { $envs['aid'] = $preRow['id']; $arc = new Archives($preRow['id']); $arc->MakeHtml(); } if(is_array($nextRow)) { $envs['aid'] = $nextRow['id']; $arc = new Archives($nextRow['id']); $arc->MakeHtml(); } } |
2、找到function GetUpdateTest() 方法,在 return $revalue;前调用上面新增方法。
1 2 3 4 |
MakePreNext($arcID,$typeid); MakeIndex(); MakeParentType($typeid); return $revalue; |
①本站所有织梦模板资源均来自用户分享和网络收集,如果侵犯了您的权益,请联系网站客服处理
②本站提供的织梦源码,均带数据及演示地址。可以在任一源码详情页查看演示地址。
③由于博主时间紧缺,所有模板源码不提供技术支持。仅部分收费原创源码提供售后
④如遇模板源码下载链接打不开或者有错误,请联系网站客服QQ指出纠正。
⑤人民币与金币汇率为1比1,即1元=1金币
织梦楼 » 织梦火车采集器采集完文章并更新栏目页、首页、上下篇的方法
织梦楼 » 织梦火车采集器采集完文章并更新栏目页、首页、上下篇的方法