[SOLVED] Automatically moving old NEWS to archive

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
bmohor3
Forum Members
Forum Members
Posts: 19
Joined: Sat Jan 12, 2008 8:49 pm

[SOLVED] Automatically moving old NEWS to archive

Post 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
Last edited by bmohor3 on Wed Jun 05, 2013 3:31 pm, edited 1 time in total.
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: Automatically moving old NEWS to archive

Post 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.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Automatically moving old NEWS to archive

Post by Rolf »

Or something like:

News page

Code: Select all

{news number='10'}
Archive page

Code: Select all

{news start='11'}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Automatically moving old NEWS to archive

Post 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).
bmohor3
Forum Members
Forum Members
Posts: 19
Joined: Sat Jan 12, 2008 8:49 pm

Re: Automatically moving old NEWS to archive

Post by bmohor3 »

Thanks for your tips. Found the solution.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Automatically moving old NEWS to archive

Post by Rolf »

bmohor3 wrote:Thanks for your tips. Found the solution.
Cool. Please http://forum.cmsmadesimple.org/viewtopi ... =8&t=13968
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Automatically moving old NEWS to archive

Post by velden »

bmohor3 wrote:Thanks for your tips. Found the solution.
How did you implement this?
bmohor3
Forum Members
Forum Members
Posts: 19
Joined: Sat Jan 12, 2008 8:49 pm

Re: Automatically moving old NEWS to archive

Post 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.
Post Reply

Return to “CMSMS Core”