Page 1 of 1

[SOLVED] Automatically moving old NEWS to archive

Posted: Mon Jun 03, 2013 8:41 am
by bmohor3
Is there a way that I made a new category (e.g. old news) in News and after a while (e.g. 1 month) News that are older than 1 month are automatically moved to old news?

Thanks for your anwsers
Bostjan

Re: Automatically moving old NEWS to archive

Posted: Mon Jun 03, 2013 10:23 am
by Jos
Normally one would use the expiry dates for this.
The newsarticles will stay in their category, but can automatically get inactive after the expiry date has passed.
You may need to change some options in the News admin.

Re: Automatically moving old NEWS to archive

Posted: Mon Jun 03, 2013 6:45 pm
by Rolf
Or something like:

News page

Code: Select all

{news number='10'}
Archive page

Code: Select all

{news start='11'}

Re: Automatically moving old NEWS to archive

Posted: Mon Jun 03, 2013 8:00 pm
by velden
Or use expiration date and then for archive:

Code: Select all

{News showall="1"}
In the template used for archive you could then do some date comparison against $item->enddate and depending on use $item->startdate.

You can do that comparison too to get an automatic archive but I think using an expiration will make the 'current' news query a lot more efficient (more efficient then calling all news items and then in the template compare all startdates agains now() and determine which news items are < 1 month).

Re: Automatically moving old NEWS to archive

Posted: Tue Jun 04, 2013 11:36 am
by bmohor3
Thanks for your tips. Found the solution.

Re: Automatically moving old NEWS to archive

Posted: Tue Jun 04, 2013 11:47 am
by Rolf
bmohor3 wrote:Thanks for your tips. Found the solution.
Cool. Please http://forum.cmsmadesimple.org/viewtopi ... =8&t=13968

Re: Automatically moving old NEWS to archive

Posted: Tue Jun 04, 2013 12:00 pm
by velden
bmohor3 wrote:Thanks for your tips. Found the solution.
How did you implement this?

Re: Automatically moving old NEWS to archive

Posted: Wed Jun 05, 2013 3:31 pm
by bmohor3
velden wrote:
bmohor3 wrote:Thanks for your tips. Found the solution.
How did you implement this?
I used expiration date as you told me and on first page all the news are shown which dates are not expired yet.