学习资料_文档下载_软件应用_程序模板

 找回密码
 立即注册

QQ登录

只需一步,快速开始

手机号码,快捷登录

搜索
查看: 3134|回复: 0

织梦火车头采集让它自动生成首页、上下篇、栏目页

[复制链接]

295

主题

297

帖子

787

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
787
发表于 2020-4-20 15:07:56 | 显示全部楼层 |阅读模式
实现教程
打开 /dede/inc/inc_archives_functions.php 最下面加入3个函数
/*火车头采集自动更新主页*/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();    }

}
继续在这个文件中找到
return $revalue;
在它的上面加入
MakePreNext($arcID,$typeid);MakeIndex();MakeParentType($typeid);

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

HI223.COM 举报邮箱:345306361@qq.com

GMT+8, 2025-7-3 20:58 , Processed in 0.078985 second(s), 18 queries .

Powered by HI223分享社区 2.3

© 2019-2020 Hi223 All Right Reserved

渝公网安备 50022502000358号

渝ICP备14008270号-3