菜鸡源码,专注精品下载!
当前位置:首页 > 建站教程 > 建站知识

如何实现织梦CMS自动更新主页的方法

发布时间:2024-01-05  栏目:建站知识   浏览:   分类:织梦cms教程

织梦CMS自动更新主页方法如下:首先,登录织梦后台,找到“系统”-“系统基本参数”-“核心设置”,将“网站首页更新频率”设置为“1小时”或“每天”。然后,进入“模板”-“默认模板管理”,找到首页模板文件(通常是index.htm),在文件中添加以下代码: ```php <?php $dsql->ExecuteNoneQuery("UPDATE dede_archives SET rank=0"); $dsql->ExecuteNoneQuery("INSERT INTO dede_addonarticle (aid,title,shorttitle,description,writer,source,litpic,click,money,senddate,top,status,ismake,typeid,firsttitle,ishtml,indexurl,moresite,filename,userip,totaldown,newstime,truetime,lastdotime,checknum,downlink,size,ddtarget_fid)

<?phprequire_once(dirname(__FILE__)."/../include/common.inc.php");$row=$dsql->GetOne("SelectuptimeFrom`cmsxx_arccache`wheremd5hash='autonew';");if(!is_array($row))exit(autonew(5));$interval=60;//时间秒if(time()-$row['uptime']<$interval)exit();autonew($no);functionmachom($no=''){define('DEDEADMIN',ereg_replace("[/]{1,}",'/',dirname(__FILE__)));require_once(dirname(__FILE__)."/../include/common.inc.php");require_once(dirname(__FILE__)."/../include/arc.partview.class.php");$dsql=newDedeSql(false);$row=$dsql->GetOne("Select*Fromcmsxx_homepageset");$dsql->Close();$templet=$row['templet'];$position=$row['position'];$homeFile=DEDEADMIN."/".$position;$homeFile=str_replace("","/",$homeFile);$homeFile=str_replace("//","/",$homeFile);$templet=str_replace("{style}",$cfg_df_style,$templet);$pv=newPartView();$GLOBALS['_arclistEnv']='index';$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet);$pv->SaveToHtml($homeFile);}functionautonew($no=''){global$dsql;$sql="SELECTidFROM`cmsxx_archives`wherearcrank<>'0'limit$no;";$dsql->SetQuery($sql);$dsql->Execute();while($row=$dsql->GetArray()){$id=$row['id'];$time=time()-rand(0,$interval*10);$dsql->ExecuteNoneQuery("Update`cmsxx_arctiny`set`arcrank`='0',`sortrank`='$time'whereid='$id';");$dsql->ExecuteNoneQuery("Update`cmsxx_archives`set`arcrank`='0',`sortrank`='$time',`pubdate`='$time'whereid='$id';");}machom($no);$dsql->ExecuteNoneQuery("Update`cmsxx_arccache`set`uptime`=".time()."wheremd5hash='autonew'");}?>


相关文章

    无相关信息
评论
建站知识
建站知识
使用技巧
调试安装
运营推广