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

Life is short , play more!
本文来自lihao's Blog,转载请注明。

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!


发表评论

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