Moving listings to archive.

14 posts by 5 authors in: Forums > CMS Builder
Last Post: September 10, 2010   (RSS)

I have a news list page and a news archive list page. I want to be able to easily move old news stories from the news list page to the archive page. Either manually or by some code.

Re: [MercerDesign] Moving listings to archive.

By ross - December 8, 2009

Hi there.

Thanks for posting!

The first thing to decide is if your news and archived news are in separate sections. I think the options will be easier if it's all one section but not impossible if they aren't.

Also, do articles become archived after a certain amount of time or do you want to archive them manually.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] Moving listings to archive.

Hi

They are in separate sections and I would want to move them manually as some news stories will want to be relevant for longer.

Thanks.

Re: [MercerDesign] Moving listings to archive.

By Chris - December 10, 2009

Hi MercerDesign,

This is pretty easy to set up if you keep both current and archived news articles in the same section. You can use "where" clauses on your viewer pages to select either your current or archived news.

If you want manual control over when your articles become "archived", you can use a checkbox field. You can even combine manual and automatic archiving by having more complicated where clauses, but let's get the simple solution working first.

Create a "news" multi-record section, and add a checkbox field to it called "archived". Generate list viewer code and paste it into two files. In one file add this line after 'tableName' => 'news':

'where' => 'archived = 0',

... and in the other file, add this instead:

'where' => 'archived = 1',

The first file will list articles which haven't been archived yet; the second will only list archived articles.

I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Moving listings to archive.

By reubs - April 9, 2010

I've got this working on a website I've built, but need some help with setting up more than one archive. Basically I have a main news page and have created two archives, one for 2010 and another for 2009. I've used the 'where' => 'archived = 0' and 'where' => 'archived = 1', along with a checkbox to make the 2010 stories go in their corresponding archive. What 'where' clause do I need to make the 2009 archive work?

Re: [reubs] Moving listings to archive.

By Chris - April 9, 2010 - edited: April 9, 2010

Hi reubs,

How about using a dropdown (i.e. list field) for which archive the article belongs to instead of a checkbox? That way you won't have 10 checkboxes after 10 years.

Then you can do this:

'where' => " archive = '' ", // get articles which are not archived

...and this:

'where' => " archive = '2009' ",

...and this:

'where' => " archive = '2010' ",

...et cetera.

Does that help? Please let me know if you have any questions.
All the best,
Chris

Re: [reubs] Moving listings to archive.

By Chris - April 12, 2010

Hi reubs,

Glad to help! :)
All the best,
Chris

Re: [chris] Moving listings to archive.

Hi Guys,

Taking this post a bit further....I'd like to be able to do something similar but with three options for each entry:
- current
- forthcoming
- previous

I'd like to do it so that one of these checkbox options must be chosen - I think it would then be more obvious for the user. Could you tell me what I would need to do/add to get this to work?

Thanks! [:)]

Re: [Kittybiccy] Moving listings to archive.

By Chris - September 7, 2010

Hi Kittybiccy,

The nature of checkboxes is that more than one can be checked. If you want to make sure your users select only one option, you're going to want to use a List Field, which can display as either radio buttons (they look like checkboxes, but round) or a dropdown.

Once you have your List Field set up, you can add a where clause to a viewer page to only show records which have one of the options selected. For example, if your List Field was called "when":

'where' => " when = 'current' ",

This setup is great if you want manual control over moving articles between the different settings. There are other potential solutions involving date fields which you could use to automatically decide which articles belong in the current, forthcoming, and previous lists dynamically.

I hope this helps! Please let me know if you have any questions.
All the best,
Chris