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

优采云 发布时间: 2020-04-28 11:01

  

  织梦使用火车头采集器采集数据火车头采集教程,发布文档后是不会手动生成首页、上下篇、栏目页的,我们可以给织梦添加手动生成代码来实现

  打开 /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(&quot;SELECT id FROM `dede_arctiny` WHERE id<$aid AND arcrank>-1 AND typeid=&#39;$typeid&#39; ORDER BY id DESC&quot;);

    $nextRow = $dsql->GetOne(&quot;SELECT id FROM `dede_arctiny` WHERE id>$aid AND arcrank>-1 AND typeid=&#39;$typeid&#39; ORDER BY id ASC&quot;);    if(is_array($preRow))

    {

        $envs[&#39;aid&#39;] = $preRow[&#39;id&#39;];

        $arc = new Archives($preRow[&#39;id&#39;]);

        $arc->MakeHtml();

    }    if(is_array($nextRow))

    {

        $envs[&#39;aid&#39;] = $nextRow[&#39;id&#39;];

        $arc = new Archives($nextRow[&#39;id&#39;]);

        $arc->MakeHtml();

    }

}

  继续在这个文件中找到

  return $revalue;

  在它的下边加入

  MakePreNext($arcID,$typeid);MakeIndex();MakeParentType($typeid);

  添加完后是这样的

  

  这样添加好后火车头采集教程,无论你用火车头免登入插口还是WEB发布模块,无论是普通文章模型还是图集模型还是软件模型,都可以手动生成相关静态文件了。

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线