栏目分类:
子分类:
返回
终身学习网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
终身学习网 > IT > 软件开发 > 后端开发 > PHP > php开源框架 > ecshop

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

ecshop 更新时间:发布时间: 百科书网 趣学号
1、打开 /admin/templates/article_info.htm 文件,加一个修改时间

在第三行下面加入调用日历JS代码

<script type="text/javascript" src=http://www.iotsi.net/skin/sinaskin/image/nopic.gif style="padding: 0px; margin: 0px;" />
<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']""

转载请注明:文章转载自 www.051e.com
本文地址:http://www.051e.com/it/218819.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 ©2023-2025 051e.com

ICP备案号:京ICP备12030808号