SimplePortal

Customization => Custom Coding => Topic started by: stanyy on June 21, 2014, 05:00:41 AM

Title: Sort Articles by Date Added
Post by: stanyy on June 21, 2014, 05:00:41 AM
Hi,
I am mostly interested in the 'Article Block' and not the article index. The current available options for sorting articles on the article block is:
Latest: Articles are sorted by date post was made.
Random: Articles are sorted randomly

I would like to sort the articles based on the date it was added as an article, that is, the most recently added article would appear at the top of the list.

I am not sure how to go about this, so if anyone can help it would be great.
Title: Re: Sort Articles by Date Added
Post by: stanyy on June 23, 2014, 12:40:11 PM
Can I bump this?..... oops :)
Title: Re: Sort Articles by Date Added
Post by: AngelinaBelle on June 23, 2014, 07:29:02 PM
Have a look at the articles table.  (You can use phpmyadmin to inspect it) I do not believe that the date something was made an article is saved.

And so, to make this happen you need to
1) save the date/time that a topic was made an article
2) then rewrite the code that gets the articles and orders them.
Title: Re: Sort Articles by Date Added
Post by: stanyy on June 24, 2014, 07:24:51 PM
Your anti-lazybones manner of response was worth it after all :).

I have not been able to access phpmyadmin for a while (blank page), probably something to do with my browser or flash plugin. Anyway, i took a look into the portal files and luckily enough, there were queries for article id. I just changed the sorting from poster time to article id and it worked perfectly. Sweet.
Title: Re: Sort Articles by Date Added
Post by: AngelinaBelle on June 26, 2014, 09:44:57 AM
That is another way to approach it!
Welcome to the wonderful world of SimplePortal customization!
SimplePortal 2.3.8 © 2008-2024, SimplePortal