Ecshop模板网
首页 > ecshop教程 > ecshop经验分享 > 让ecshop文章列表以更新时间排序
文章详情

让ecshop文章列表以更新时间排序

ecshop模板网 / 2014-01-09

ecshop的文章记录时间是表段add_time,默认情况后台添加一次,系统记录一次,以后所有的文章显示就以ID排序。若后台更新该文章,add_time添加时间还是不变化.  但是我们有时候经常去维护老文章,想让该文章放在最前,如本站ecshop模板堂效果。怎么办?

方法简单。

先修改后台:

找到ecshop的添加文档,admin/article.php文件。找到288行

    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 = gmtime();

    if ($exc->edit("title='$_POST[title]', add_time='$add_time',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']))  

再找到includes/lib_article.php

找到48与56行

      ' ORDER BY article_type DESC, article_id DESC';

修改成

' ORDER BY article_type DESC, add_time DESC';

这个效果目的是优化,让ecshop文章更大的收录!

下一篇: 修正ecshop程序在绑定目录下访问跳出文件夹问题 上一篇: 滚动显示ecshop最新订单效果
 用户评论(共 0 条评论)
  • 暂时还没有任何用户评论
用户名: 匿名用户 E-mail:
当前心情:
评论内容:
验证码: captcha
返回顶部 返回首页
 
QQ在线咨询
售前电话热线
#
售前QQ客服