织梦批量发布文章

织梦批量发布文章,第1张

第一步调用随机文章:

智盟给出随机文章调用的参数如下:

{ dede:arclist sort = rsquo;兰德 rsquotitlelen=48 row=16}

lt;李 gt lta href = "[field:arcurl/]" title = "[field:title/]" target = " _ blank " >[field:title/] lt;/a gt; lt/李 gt

{/dede: arclist}

这个列表代码可以调出随机的文章,每次动态页面刷新时都会发生变化。但是由于织梦在首页生成的是静态html,如果不手动生成的话还是不会改变的,所以用下面的方法。

步骤2:设置预设的自动文件更新:

复制下面的代码,粘贴到一个名为:autoindex.php的新文件中,上传到ftp的plus文件夹。看清楚是在加号文件夹里,位置不对不会生效:

lt;?php

函数sp_input( $text )

{

$ text = trim($ text);

$ text = htmlspecialchars($ text);

如果(!get_magic_quotes_gpc() )

return addslashes($ text);

else

return $ text;

}

$ autotime = 3600;//自动更新时间,单位是秒,这里我设置为一小时,你可以自己更改。

$fpath = "../data/last _ time . Inc ";//记录更新时间文件。如果无法实现目标,请检查您是否有读取权限。

include($ fpath);

if(empty($ last _ time))

$ last _ time = 0;

if(sp _ input($ _ GET[' renew '])= = " now ")

$ last _ time = 0;

if((time()-$ last _ time) gt;=$autotime )

{

定义( lsquoDEDEADMIN rsquo,ereg_replace("[/\]{1,} ", rsquo/',dirname(_ _ FILE _ _));

require_once(DEDEADMIN。"/../include/common . Inc . PHP ");

require_once(DEDEINC ."/arc . part view . class . PHP ");

/*

$ row = $ dsql- gt;get one(" Select * From dede _ home pageset ");

$ dsql- gt;close();

$ templet = $ row[' templet '];

$ position = $ row[' position '];

*/

$ templet = " tnbjh/index . htm ";//这里是首页模板位置,目前是dede默认的首页位置。

$position = "../index . html ";

$ homeFile = dirname(_ _ FILE _ _)。"/".$位置;

$homeFile = str_replace( "\ ","/",$ homeFile);

$ homeFile = str _ replace("//"/" $ homeFile);

$ PV = new part view();

$ PV- gt;SetTemplet( $cfg_basedir。$cfg_templets_dir。"/".$ templet);

$ PV- gt;SaveToHtml($ home file);

$ PV- gt;close();

$file = fopen( $fpath," w ");

fwrite( $file," lt?PHP \ n ");

fwrite( $file," $last_time= "。时间()。";\ n ");

fwrite( $file,'? gt');

fclose($ file);

}

? gt

然后我们需要在首页的模板代码head标签中添加一段代码:

lt;script src = "/plus/auto index . PHP " language = " JavaScript " gt; lt/script gt;

然后在后台点击生成,更新首页。

欢迎分享,转载请注明来源:聚客百科

原文地址: http://juke.outofmemory.cn/life/712984.html

()
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-07-13
下一篇 2022-07-13

发表评论

登录后才能评论

评论列表(0条)

保存