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

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>{$lang.author}</td>
  <td><input type="text" name="author" maxlength="60" value="{$article.author|escape}" /></td>
</tr>

在其下面添加以下代码
<!--新加日期修改 开始-->
<tr>
  <td>{$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}"/></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']))


【免责声明】:

本站所发布的一切资源仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。

【关于转载】:

本站尊重互联网版权体系,本站部分图片、文章大部分转载于互联网、所有内容不代表本站观点、不对文章中的任何观点负责、转载的目的只用于给网民提供信息阅读,无任何商业用途,所有内容版权归原作者所有
如本站(文章、内容、图片、视频)任何资料有侵权,先说声抱歉;麻烦您请联系请后台提交工单,我们会立即删除、维护您的权益。非常感谢您的理解。

【附】:

二○○二年一月一日《计算机软件保护条例》第十七条规定:为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬!鉴于此,也希望大家按此说明研究软件!

注:本站资源来自网络转载,版权归原作者和公司所有,如果有侵犯到您的权益,请第一时间联系我们处理!

-----------------------------------------------------------------------------------------------------------

【版权声明】:

一、本站致力于为源码爱好者提供国内外软件开发技术和软件共享,着力为用户提供优资资源。
二、本站提供的源码下载文件为网络共享资源,请于下载后的24小时内删除。如需体验更多乐趣,还请支持正版。
三、如有内容侵犯您的版权或其他利益的,请编辑邮件并加以说明发送到站长邮箱。站长会进行审查之后,情况属实的会在三个工作日内为您删除。
-----------------------------------------------------------------------------------------------------------


内容投诉
源码村资源网 » ecshop后台文章加上日期时间的方法
您需要 登录账户 后才能发表评论

发表评论

欢迎 访客 发表评论