Moving listings to archive.
14 posts by 5 authors in: Forums > CMS Builder
Last Post: September 10, 2010 (RSS)
Re: [MercerDesign] Moving listings to archive.
By ross - December 8, 2009
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.
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
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.
Chris
Re: [chris] Moving listings to archive.
By reubs - April 9, 2010
Re: [reubs] Moving listings to archive.
By Chris - April 9, 2010 - edited: April 9, 2010
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.
Chris
Re: [chris] Moving listings to archive.
By reubs - April 12, 2010
Thanks. That works perfectly and made things a lot easier.
Re: [reubs] Moving listings to archive.
By Chris - April 12, 2010
Glad to help! :)
Chris
Re: [chris] Moving listings to archive.
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
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.
Chris