RandomNews - Limit by Date?

All new Coranto Addons, updates and patches to addons, will be released here...also, get support for addons within!

Moderators: Spunkmeyer, Dale Ray, SrNupsen, Bluetooth, Jackanape

Postby SrNupsen » Mon Oct 08, 2007 12:17 pm

Nope. And I don't have time to do the work for you. But based on what Dale said about modifying the SQL query inside cra_randomnews, you should be able to:

1. Decide maximum how old the news used for the random query should be (in seconds, since you will be using Unix time).

2. Work out a SQL query that says "select items where ((current time) - (newstime) < x))" where x is the number of seconds you got in 1.

Example: If you want your random news to be no more than 1 month old, x would equal (30 * 24 * 60 * 60) = 2592000
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby web » Mon Oct 08, 2007 12:47 pm

that's what i wanted to know - what ormat in i have to write date.
you said - seconds.
thanks. i'll try later.
User avatar
Posts: 177
Joined: Sun Nov 30, 2003 3:39 pm

Postby web » Sun Oct 14, 2007 7:52 am

here it is
Code: Select all
      if (defined($in{"category"})) {
                     $query = "SELECT * FROM $CConfig{CorantoSQL_tblname} WHERE Category = '".$in{"category"}."' AND newstime > '".time()."' - 86400";
         else {
            $query = "SELECT * FROM $CConfig{CorantoSQL_tblname}";
User avatar
Posts: 177
Joined: Sun Nov 30, 2003 3:39 pm

Postby Dale Ray » Tue Oct 16, 2007 1:19 pm


I haven't tried your code but thanks for sharing your solution with everyone. I am assuming that the code you posted is a modification to the randomnews script?
Dale Ray
User avatar
Dale Ray
Posts: 1008
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby web » Tue Oct 16, 2007 1:25 pm

yeah, it's a modification to the randomnews script
User avatar
Posts: 177
Joined: Sun Nov 30, 2003 3:39 pm


Return to Addon Release and Support

Who is online

Users browsing this forum: No registered users and 2 guests