Joomla 1.7 and Joomla 2.5中限制related_itmes模块返回的文章数量

Joomla 1.7 has a nice module mod_related_items (Articles Related) that shows articles related to the current one the visitor is browsing. It has one issue though, you can’t set a limit.

So a little code hacking is in order. Open modules/mod_related_items/helper.php and go to line 94 (right after the Filter by language if) and modify $db->setQuery($query); to read:

View Code PHP

$db->setQuery($query,0,10);

Of course you can change the limit from 10 with whatever you like. Random order is commented out because using ORDER BY RAND has performance issues. If you think you can handle it feel free to uncomment.

This hack also works for Joomla 2.5!

此篇文章已被阅读1736 次

Tags:

Add a Comment

邮箱地址不会被公开。 必填项已用*标注