TinyPortal
Development => Block Codes => Topic started by: PepeSmith on May 28, 2013, 08:58:19 AM
Hi
Just need help on using the Articles in a category block.
So I've set it up on the right side of my forum and everything is fine and shows all the articles.
My only problem is I want my newest Articles to be on the top of the list and the oldest ones at the bottom. How do I do that?
Can check it out at pokermanila dot com
It is the block named Article List thanks in advance ;D
I think it's this section in the Sources/TPortal.php file.
// any cat listings from blocks?
if(isset($test_catbox) && $fetchtitles != '')
{
$request = $smcFunc['db_query']('', '
SELECT art.id, art.subject, art.date, art.category, art.author_id as authorID, art.shortname,
IFNULL(mem.real_name,art.author) as real_name FROM {db_prefix}tp_articles AS art
LEFT JOIN {db_prefix}members AS mem ON (art.author_id = mem.id_member)
WHERE ' . $fetchtitles . '
AND ((art.pub_start = 0 AND art.pub_end = 0)
OR (art.pub_start != 0 AND art.pub_start < '.$context['TPortal']['now'].' AND art.pub_end = 0)
OR (art.pub_start = 0 AND art.pub_end != 0 AND art.pub_end > '.$context['TPortal']['now'].')
OR (art.pub_start != 0 AND art.pub_end != 0 AND art.pub_end > '.$context['TPortal']['now'].' AND art.pub_start < '.$context['TPortal']['now'].'))
AND art.off = 0
AND art.category > 0
AND art.approved = 1'
);
Just add your ORDER BY art.date DESC to that query I think.