您现在的位置是:首页 > cms教程 > Ecshop商城教程Ecshop商城教程

ecshop文章信息添加时间的修改方法

李具匡2024-01-16Ecshop商城教程已有人查阅

导读ecshop实现后台文章信息可以修改添加时间的方法。有时我们希望将过去发布的新闻改成今天发布的,或者是今天发布的文章,希望改成是过去发布的,ECSHOP教

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 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']))
OK了!

本文标签:

很赞哦! ()

相关源码

  • html5响应式pbootcms模板新闻资讯博客网站源码该模板采用PbootCMS内核开发,专为新闻资讯类网站打造,同时具备高度行业适配性--只需替换图文内容即可快速转型为企业官网、行业门户等各类站点。查看源码
  • (PC+手机)帝国cms7.5漫画图片连载网站源码免费下载本模板基于帝国CMS7.5深度开发,为漫画阅读类网站打造。整体设计风格贴合漫画行业特性,界面布局充分考虑漫画作品的展示需求,支持多种漫画阅读模式。模板采用响应式设计,能够自动适配PC端和移动端设备,为读者提供流畅的阅读体验。查看源码
  • (自适应响应式)HTML5甲醛环境检测网站模板带在线留言和资料下载本模板为甲醛检测与环保科技企业开发,采用PbootCMS内核构建。首页集成空气质量数据可视化模块,服务流程采用时间轴展示设计,检测报告板块支持PDF在线预览功能查看源码
  • (自适应)黑色摄影作品工作室pbootcms模板网站源码下载为风景摄影、个人工作室打造的高端网站模板,基于PbootCMS开源内核开发,采用HTML5自适应架构,PC与移动端实时数据同步,适配各类拍摄作品展示需求。查看源码
  • (自适应)代理记账财务会计咨询服务个人公司网站模板该响应式网站模板为代理记账、财政咨询及财务会计类企业设计,基于PbootCMS内核开发。通过自适应手机端的HTML5技术,帮助企业高效构建专业财税服务平台查看源码
  • (自适应响应式)HTML5磁电机械设备蓝色营销型网站pbootcms模板本模板为磁电设备行业设计,采用蓝色营销风格,突出工业设备的专业性和技术感。模板结构清晰,能够有效展示磁电设备的技术参数、应用场景和企业实力,帮助客户快速了解产品特点和公司服务。查看源码
分享笔记 (共有 篇笔记)
验证码:

本栏推荐