TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 281
  • Total: 281

Article Block help

Started by PepeSmith, May 28, 2013, 08:58:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PepeSmith

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

IchBin

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.

This website is proudly hosted on Crocweb Cloud Website Hosting.