TinyPortal
Development => Support => Topic started by: othersi on December 20, 2006, 09:45:53 PM
Hi all.
I've got an article system set up for our forum, with 3 categories... a category block for each one showing a half dozen articles inside.
Problem is, inside the article category blocks, the articles are sorted from oldest to newest (newest articles at the bottom of the list).
So... once the number of articles is greater than the number set for scroll bars in the blocks, the new articles don't show in the list... they are "off-screen" at the bottom of the block.
When I actually browse the categories, the articles are sorted newest to oldest.
Is there a way to alter the sorting inside the article block, so that they also sort newest to oldest?
You would need to alter the file Sources/TPortal.php
Look for
// any cat listings from blocks?
if(isset($using_catlisting) && $fetchtitles!=''){
$request = db_query("SELECT art.id, art.subject, art.category, art.authorID, mem.realName FROM ({$tp_prefix}articles AS art, {$db_prefix}members AS mem) WHERE
$fetchtitles
AND art.off=0
AND art.approved=1
AND art.authorID=mem.ID_MEMBER", __FILE__, __LINE__);
$context['TPortal']['blockarticle_titles']=array();
Change it to
// any cat listings from blocks?
if(isset($using_catlisting) && $fetchtitles!=''){
$request = db_query("SELECT art.id, art.subject, art.category, art.authorID, mem.realName FROM ({$tp_prefix}articles AS art, {$db_prefix}members AS mem) WHERE
$fetchtitles
AND art.off=0
AND art.approved=1
AND art.authorID=mem.ID_MEMBER
ORDER BY art.date DESC", __FILE__, __LINE__);
$context['TPortal']['blockarticle_titles']=array();
It's just adding the "ORDER BY" line.
This will likely affect other listings of articles as well.
Excellent. Thank you. :)