• 1179阅读
  • 1回复

ecshop文章列表按添加时间排序,利于文章更好的收录

楼层直达
-IR9^)  
ecshop默认更新文章后,日期和文章位置都不变化。 Riq5Au?*)  
a#=GLB_P(  
1、第一处:admin/article.php ;APpgt4  
7 :s6W%W1*  
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']))   G! uQ|<(  
35yhe:$nf  
2、第二处:includes/lib_article.php (共2个位置更改) EIl _QV6  
把' ORDER BY article_type DESC, article_id DESC';修改成' ORDER BY article_type DESC, add_time DESC';
只看该作者 安逸沙发  发表于: 2018-08-24
ECShop默认所有的文章显示排序是根据ID编号,文章记录时间是add_time表字段,默认后台添加文章一次,系统就只记录一次时间。如果若后台更新该文章,add_time添加时间还是不会变化。但是我们有时候经常去更新维护老文章,想让该文章放在最前。怎么办? 5T sUQc  
A-:O`RK  
c/c$D;T  
r0p w_j  
本教程实现更新文章同时更新变动时间,文章显示排序根据文章添加以及更新时间。这个效果目的是优化,让ecshop文章更好的收录效果!ecshop模板 t78k4?  
@lJzr3}WZ  
/cc\fw1+  
[+O"<Ua  
1.打开/admin/article.php文件,搜索如下代码: v<Bynd-  
E=){K  
AwQ?l(iZ"p  
H'Yh2a`!o  
if ($exc->edit("title='$_POST[title]', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', ^eW}XRI  
!^Q.VYY  
/x3/Ubmz~x  
L(X6-M:  
将以上代码修改成如下代码: LjV]0%j?r  
y"Nsh>h  
mrX^2SR  
!UFfsNiXZ  
$add_time = gmtime(); k}~O}~-  
  zxp`  
if ($exc->edit("title='$_POST[title]', add_time='$add_time', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', s3W@WH^.  
 ,m,)I  
 6m6zA/  
_V\Bp=9W  
2.打开/includes/lib_article.php文件,搜索如下代码(一共有两处): \e`~i@) ~Z  
Xt#1Qs  
t!I aUW  
itzyCw2|#  
' ORDER BY article_type DESC, article_id DESC'; e${)w-R/e  
)Z %T27r,^  
S/ibb&  
~@kU3ZGJZ  
将两处以上代码修改成如下代码: mXXt'_"  
ZNx$r]4nF  
CA +uKM^"6  
{8I.`U  
' ORDER BY article_type DESC, add_time DESC';
快速回复

限100 字节
安逸网提示:如果您在写长篇帖子又不马上发表,建议存为草稿
 
认证码:
上一个 下一个