PDA

View Full Version : Random News Thread


Gary Bolton
12-19-2005, 07:19 AM
I have my news displayed on my my portal taken from two boards. One's a "Site News" Board and the other is an "Articles board".

If I want to display a posting from the Site News board all the time for a week etc, I can sticky that thread which is good. But what I want to do is this with threads that are not stickys.

Instead of it grabbing the last posts from the Articles board and Site News board that not a sticky. Is there anyway of making it grab a random thread instead each time instead.

So each time a person visits the CMPS page, if there are no sticky threads, it will instead display a diiferent random thread taken from ther News and Articles board. Or whatever boards I have feeding the news module.

Brian
12-22-2005, 12:40 PM
I'm out of town and don't really have access to get you the exact code at the moment, but if you look in the modules/news.php file and change the ORDER BY clause in the query to 'ORDER BY RAND()' then that would select a random post.

Our Sponsors
 

Gary Bolton
12-22-2005, 01:28 PM
I'll wait till you get back Brian as I'm not that good at coding and would really need you to tell me what exactly to change. But I'll have a mess about though.

Brian
12-22-2005, 02:43 PM
No problem. I'll be back on Saturday and chances are I'll forget to go back to this thread, so if you could, please bump this thread sometime Saturday or after that. :)

Our Sponsors
 

Chris-777
01-17-2006, 02:26 PM
Consider this a bump. ;)

This is the line I see:


ORDER BY " . iif($mod_options['portal_news_sticky'], 'sticky DESC,') . iif($mod_options['portal_news_orderby'] == 'postdateline', 'dateline', $mod_options['portal_news_orderby']) . " $mod_options[portal_news_direction]


Just adding RAND() doesn't do it, throws a DB error.

Brian
01-17-2006, 02:40 PM
Just posted in your other thread, but I'll answer in here too incase somebody finds this by searching... You would need to replace that line with 'ORDER BY RAND()'.