• 1168阅读
  • 1回复

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

楼层直达
n@_aTY  
ecshop默认更新文章后,日期和文章位置都不变化。 hp3 <HUU  
#,CK;h9jy!  
1、第一处:admin/article.php `"h[Xb#A`b  
8>AST,  
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']))   1+v!)Y>Z&  
.1YiNmW=  
2、第二处:includes/lib_article.php (共2个位置更改) @&9, 0 x  
把' 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添加时间还是不会变化。但是我们有时候经常去更新维护老文章,想让该文章放在最前。怎么办? we _CF*zj  
n>pJ/l%`  
{xg=Ym)  
xwo *kFg  
本教程实现更新文章同时更新变动时间,文章显示排序根据文章添加以及更新时间。这个效果目的是优化,让ecshop文章更好的收录效果!ecshop模板 ZY8.p  
B0yJ9U= Fj  
eW 4[2Q  
s``a{ HZ  
1.打开/admin/article.php文件,搜索如下代码: %ud-3u52M8  
w#)u+^-  
&ic'!h"  
i tNuY<"  
if ($exc->edit("title='$_POST[title]', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', 0?ab'vYcp  
*g*"bi*  
 \xp0n  
A5F (-  
将以上代码修改成如下代码: 8nBYP+t,e  
0p[k7W u  
vcj(=\ e8v  
7WH'GoBh  
$add_time = gmtime(); r'nPP6`  
423%K$710  
if ($exc->edit("title='$_POST[title]', add_time='$add_time', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', q !9;JrX  
C.ynOo,W  
wz3X;1l`c  
nygGI_[l  
2.打开/includes/lib_article.php文件,搜索如下代码(一共有两处): &8f/6dq  
B&B4 P  
e8f 7*S8  
n;. M5}O  
' ORDER BY article_type DESC, article_id DESC'; CvRCcSJM\2  
g&$5!ifgi  
\C~6 '  
`+(n+QS _  
将两处以上代码修改成如下代码: kuBtPZ  
&k|EG![  
i@6g9\x+  
~t2" L|i  
' ORDER BY article_type DESC, add_time DESC';
快速回复

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