收藏文章 楼主
版块:AB模板网   类型:普通   作者:AB模板网   查看:8201   回复:0   获赞:0   时间:2021-10-15 12:08:35
1、打开 /admin/templates/article_info.htm 文件,加一个修改时间
在第三行下面加入调用日历JS代码
<script type="text/javascript" src="../js/calendar.php?lang={$cfg_lang}"></script>
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />


找到
<tr>
  <td class="narrow-label">{$lang.author}</td>
  <td><input type="text" name="author" maxlength="60" value="{$article.author|escape}" /></td>
</tr>

在其下面添加以下代码
<!--新加日期修改 开始-->
<tr>
  <td class="narrow-label">{$lang.add_time}</td>
  <td><input name="add_time" type="text" id="add_time" size="20" value='{$article.add_time}' readonly="readonly" /><input name="selbtn1" type="button" id="selbtn1" onclick="return showCalendar('add_time', '%Y-%m-%d %H:%M', '24', false, 'selbtn1');" value="{$lang.btn_sel ect}" class="button"/></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']))

网站模板:https://www.jxmseo.com/list-89-1.html

本文转载于网络,如有侵权请联系删除


全站外链: TEC传感器 | 猫掌外链
 
回复列表
默认   热门   正序   倒序

回复:ecshop后台文章加上日期时间的方法

网站公告

近期本站被人为恶意注册及发布垃圾帖,每一个发帖都会经过审核,一经发现违法或垃圾帖的用户,帖子将被删除或封号,请大家共同维护互联网环境,共创美好互联网未来。

详细的发帖规则请阅读:

《小猪外链网发帖规则》

《小猪外链网最新金币规则》

注:本站严禁发布灰色违禁违法内容,如发现立刻永久封号,如开通会员的概不退款。

Powered by 小猪外链网 8.3.15

©2015 - 2025 小猪SEO外链平台

备案号:浙ICP备17015142号

免责申明:本网站内容由平台入驻会员撰写,除创始人账号外,其他观点仅代表作者本人,不代表小猪外链网立场。如果内容涉及侵犯其他公司、团体的利益、请联系小猪SEO外链网客服举证删除

您的IP:3.17.57.190,2025-05-01 15:20:37,Processed in 0.28146 second(s).

各位站长请准守小猪SEO外链网的发帖规则,文明理性发言

外链优化

用户名:

粉丝数:

签名:

资料 关注 好友 消息
分享
已有0次打赏