• 1178阅读
  • 1回复

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

楼层直达
]T|9>o!  
ecshop默认更新文章后,日期和文章位置都不变化。 ^7M hnA  
Fx,08  
1、第一处:admin/article.php hoY.2 B_  
j1 _ E^  
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']))   h4rIt3`  
06DT2  
2、第二处:includes/lib_article.php (共2个位置更改) zRTR  
把' 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添加时间还是不会变化。但是我们有时候经常去更新维护老文章,想让该文章放在最前。怎么办? L'u\ w  
k{'0[,mx#  
0:+WO%z  
s0PrbL%_`  
本教程实现更新文章同时更新变动时间,文章显示排序根据文章添加以及更新时间。这个效果目的是优化,让ecshop文章更好的收录效果!ecshop模板 nw-I|PVTNa  
'_V2!?+RU+  
xXM{pd  
p`l0?^r c"  
1.打开/admin/article.php文件,搜索如下代码: gSh+}r<7  
1R,:  
m%76i;uP  
YxP&7oq  
if ($exc->edit("title='$_POST[title]', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', 62Z#Y Q}x  
.,OVzW  
cZ|\.0-  
0|a(]a}V*j  
将以上代码修改成如下代码: ~/P&Tub^  
A -b [>} _  
AT%u%cE-  
2* 2wY=  
$add_time = gmtime(); Dp':oJC  
'JRvP!]  
if ($exc->edit("title='$_POST[title]', add_time='$add_time', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', hK_LEwd;  
@WVcY:1t#  
{$wjO7Glp  
 m5r7  
2.打开/includes/lib_article.php文件,搜索如下代码(一共有两处): [_}J F}6  
Y$?9Zkp>  
6e[VgN-s  
;<(W% _  
' ORDER BY article_type DESC, article_id DESC'; #3+!ee27#  
)3>hhuaa  
6x%h6<#xh*  
-}KC=,]vh  
将两处以上代码修改成如下代码: N19({0+i2  
1*@'-mj  
uA#P'?  
:gep:4&u  
' ORDER BY article_type DESC, add_time DESC';
快速回复

限100 字节
安逸网提示:如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
认证码:
上一个 下一个