Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Hulatt 47 posts 59 karma points
    Apr 23, 2009 @ 10:40
    Paul Hulatt
    0

    Automatically archive news stories

    I'm developing a website that will have multiple news stories added each day, up to around 20 and I'd like to work out a way of keeping the news structure for the editors uncluttered.

    The way I was thinking of doing this was to have the news stories held within a news folder until they are two weeks old and after that date they are automatically moved into a date folder like folder structure. Something like the following:

    Site Root
    |--News
    | |--Archive
    | | |--2008
    | | | |--Nov
    | | | |--Dec
    | | |--2009
    | | | |--Jan
    | | | |--Feb
    | | | |--Mar
    | | | |--Apr
    | |--News Story
    | |--Another News Story

    The reason for having this split design is so that news stories can be ordered by ascending SortOrder when new as they will not neccessarily be shown in their published order. So in the example above "Another News Story" will be shown first, then "News Story", followed by the items in 2009/Apr, 2009/Mar etc.

    Is it possible to implement an action handler that will look at nodes within the "News" node and move them to the appropriate archive folder when they are more that two weeks old?

    Any help would be gratefully received.

    Thanks in advance.


    Paul

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 23, 2009 @ 11:22
    Dirk De Grave
    0

    Hi Paul,

    I'm thinking of two approaches:

    - Indeed, use an event handler (v4 no longer uses the 'action handler' term) to move existing nodes to 'archive' node.
    - Create a scheduled task, which is just another aspx page (Remember to let umbraco ignore the page, eg. putting it into the /umbraco folder) and make some config changes for the scheduled task to run at regular intervals.

    I'd go with the first, as news items are being created at a regular interval (less then the 'Archive' interval settings)

    Hope this helps.

    Regards,
    /Dirk


  • Richard Soeteman 4035 posts 12842 karma points MVP
    Apr 23, 2009 @ 11:26
    Richard Soeteman
    0

    Hi Paul,

    On my weblog I have a demo where you can automaticly set the expire data of a news item. Then you have to hook into another event. The Unpublish event where you can move the document to your archive folder.

    Hope it helps you

  • Paul Hulatt 47 posts 59 karma points
    Apr 23, 2009 @ 12:21
    Paul Hulatt
    0

    Thanks for your help guys. A couple of quick questions before I embark on this journey!

    The examples relate an event for a specific node. Is it possible to perform actions on other nodes of the same type when an event is raised or can you only modify the current node?

    Also, could you give any pointers how would I be able to work out when an event is fired which archive node to move the news item to?

    Hopefully that makes sense? As this'll be the first time I've delved into this area of Umbraco any extra help you can give would be invaluable.

    Paul

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 23, 2009 @ 13:04
    Dirk De Grave
    0

    Paul,

    Basically, anything is possible... Yeah, right, that's what all wizards say...

    If you'd wire up an event, in most cases you'll get a reference to the node that is firing the event, but you're free to do whatever is required... And it's possible to perform actions on other nodes as well.

    Deciding on which archive node to move to... depends on the 'real life' scenario you have in mind. Most simple solution is to store the node id in web.config file as app key, but that's just one option... it all depends on how to/where to move the nodes.

    Hope this helps.

    Regards,
    /Dirk

Please Sign in or register to post replies

Write your reply to:

Draft