LSRONG-双荣设计
扫描二维码添加QQ好友

扫一扫二维码,加我QQ

在Ecshop文章列表页显示内容摘要的方法[ecshop二次开发]

2016-03-27 11:03:52ecshop常见问题

里奥模板中心技术为您整理,在Ecshop文章列表页显示内容摘要的方法。

 

本教程中讲到的“内容摘要”指的是文章内容的前 60个字符(当然也可以是前40个,前50个等等)

下面以默认模板 为例进行讲解:

1)、修改 includes/lib_article.php  文件
搜索
$sql = 'SELECT article_id, title, author, add_time, file_url, open_type' .

 
一共能搜到两处,每一处都改为

 
$sql = 'SELECT article_id, title,content, author, add_time, file_url, open_type' .

 
继续找到

 
$arr[$article_id]['title']       = $row['title'];

 

在它下面增加一行代码

 
$arr[$article_id]['content']       = strip_tags($row['content']);

 
2)、打开 模板文件 /themes/default/article_cat.dwt

 
搜索找到

 
{$article.short_title}</a>

 

在它后边增加代码

 
<br>{$article.content|truncate:60}

文章关键词