找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 167|回复: 0

[cms教程] 织梦dedecms定时自动更新首页的方法

[复制链接]

该用户从未签到

发表于 2021-9-18 08:52:20 | 显示全部楼层 |阅读模式

您需要 登录 才可以下载或查看,没有账号?立即注册

×
dedecms织梦模板定时自动更新首页的方法如下:
         
        1、在 根目录/plus 目录下新建一个php文件,命名为:autoindex.php
         
        2、将以下代码复制到 autoindex.php 文件
       
       
               
                       
                               
                                       
=$autotime )
{
define('DEDEADMIN', ereg_replace("[/\\,{1,}",'/',dirname(__FILE__) ) );
require_once(DEDEADMIN."/../include/common.inc.php");
require_once(DEDEINC."/arc.partview.class.php");
/*
$row = $dsql->GetOne("Select * From dede_homepageset");
$dsql->Close();
$templet=$row['templet',;
$position=$row['position',;
*/
$templet = “tnbjh/index.htm”;//这里是首页模板位置,当前是dede默认首面位置。
$position = "../index.html";
$homeFile = dirname(__FILE__)."/".$position;
$homeFile = str_replace("\\", "/", $homeFile );
$homeFile = str_replace( "//", "/", $homeFile );
$pv = new PartView();
$pv ->SetTemplet( $cfg_basedir.$cfg_templets_dir."/".$templet );
$pv -> SaveToHtml( $homeFile );
$pv -> Close();
$file = fopen( $fpath, "w");
fwrite( $file, "' );
fclose( $file );
}
?>
                               
                       
               
       

        3、在首页模板的标签中加入如下代码
         
       
         
        以上就是本文章的内容,希望对大家有所帮助
回复

使用道具 举报

网站地图|页面地图|文字地图|Archiver|手机版|小黑屋|找资源 |网站地图

GMT+8, 2024-10-10 19:27

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表