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

Recent

Welcome to TinyPortal. Please login or sign up.

April 30, 2024, 08:16:04 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,174
  • Total Topics: 21,220
  • Online today: 147
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 123
  • Total: 124
  • @rjen

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.