[SOLVED] How to sort news articles by end time AND news title?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
CWUscholar
New Member
New Member
Posts: 4
Joined: Wed Nov 03, 2010 12:10 am

[SOLVED] How to sort news articles by end time AND news title?

Post by CWUscholar »

I'm able to sort my news articles alphabetically (sortby="news_title") or by "expiration date" (sortby="end_time"), but not both, it seems.

Sorry if this is a stupid question, but how do I get my news articles to sort primarily by end_time and secondarily by news_title?

Thank you in advance.
Last edited by CWUscholar on Wed Nov 03, 2010 1:45 am, edited 1 time in total.
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: How to sort news articles by end time AND news title?

Post by Wishbone »

{news sortby="end_time,news_title"}

In effect, the code queries the database with "ORDER BY $sortby", which can take a comma-separated list, though it does filter out single quotes and semi-colons, so that you can't do too much SQL injection. At least in 1.6.6.. I don't know if this section changed later. I need to upgrade. :)
Last edited by calguy1000 on Wed Nov 03, 2010 2:09 am, edited 1 time in total.
CWUscholar
New Member
New Member
Posts: 4
Joined: Wed Nov 03, 2010 12:10 am

Re: [SOLVED] How to sort news articles by end time AND news title?

Post by CWUscholar »

Thank you very much!  I really appreciate it!
Post Reply

Return to “CMSMS Core”