找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 164|回复: 0

[cms教程] ecshop后台文章加上日期时间的方法

[复制链接]

该用户从未签到

发表于 2015-11-17 09:35:28 | 显示全部楼层 |阅读模式

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

×
1、打开 /admin/templates/article_info.htm 文件,加一个修改时间
在第三行下面加入调用日历JS代码



找到
[tr]
  [td]{$lang.author}[/td]
  [td][i,[/td]
[/tr]

在其下面添加以下代码

[tr]
  [td]{$lang.add_time}[/td]
  [td][i,[i,[/td]
[/tr]


2、打开 /admin/article.php 文件
找到
/*初始化*/
$article = array();
$article['is_open', = 1;

在其下面添加以下代码
$article['add_time', = local_date('Y-m-d H:i');

找到
/* 取文章数据 */
$sql = "SELECT * FROM " .$ecs->table('article'). " WHERE article_id='$_REQUEST[id,'";
$article = $db->GetRow($sql);

在其下面添加以下代码
$article['add_time', = local_date('Y-m-d H:i',$article['add_time',);

找到
/*插入数据*/
$add_time = gmtime();
if (empty($_POST['cat_id',))
{
$_POST['cat_id', = 0;
}
$sql = "INSERT INTO ".$ecs->table('article')."(title, cat_id, article_type, is_open, author, ".
    "author_email, keywords, content, add_time, file_url] open_type, link, description) ".
    "VALUES ('$_POST[title,', '$_POST[article_cat,', '$_POST[article_type,', '$_POST[is_open,', ".
    "'$_POST[author,', '$_POST[author_email,', '$_POST[keywords,', '$_POST[FCKeditor1,', ".
    "'$add_time', '$file_url', '$open_type', '$_POST[link_url]', '$_POST[description,')";
$db->query($sql);

修改为:
/*插入数据*/
$add_time = gmtime();
if (empty($_POST['cat_id',))
{
$_POST['cat_id', = 0;
}
$add_time = local_strtotime($_POST['add_time',);
$sql = "INSERT INTO ".$ecs->table('article')."(title, cat_id, article_type, is_open, author, ".
    "author_email, keywords, content, add_time, file_url] open_type, link, description) ".
    "VALUES ('$_POST[title,', '$_POST[article_cat,', '$_POST[article_type,', '$_POST[is_open,', ".
    "'$_POST[author,', '$_POST[author_email,', '$_POST[keywords,', '$_POST[FCKeditor1,', ".
    "'$add_time', '$file_url', '$open_type', '$_POST[link_url]', '$_POST[description,')";
$db->query($sql);

        
找到
if ($exc->edit("title='$_POST[title,', cat_id='$_POST[article_cat,', article_type='$_POST[article_type,', is_open='$_POST[is_open,', author='$_POST[author,', author_email='$_POST[author_email,', keywords ='$_POST[keywords,', file_url ='$file_url', open_type='$open_type', content='$_POST[FCKeditor1,', link='$_POST[link_url]', description = '$_POST[description,'", $_POST['id',))
修改为:
$add_time = local_strtotime($_POST['add_time',);
if ($exc->edit("title='$_POST[title,', cat_id='$_POST[article_cat,', article_type='$_POST[article_type,', is_open='$_POST[is_open,', author='$_POST[author,', add_time='$add_time', author_email='$_POST[author_email,', keywords ='$_POST[keywords,', file_url ='$file_url', open_type='$open_type', content='$_POST[FCKeditor1,', link='$_POST[link_url]', description = '$_POST[description,'", $_POST['id',))
回复

使用道具 举报

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

GMT+8, 2024-10-6 01:40

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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