u-nikos Posted January 3, 2013 Share Posted January 3, 2013 ProcessDateArchiverProcessWire Date Archiver ProcessAutomatically archives pages based on a Datetime field (e.g. /news/2013/01/03/some-news-item/).Behavior- When you add a page with a specified template, the module will automatically create year/month/day archives for it.- When you change the date in a specified Datetime field, the page is automatically moved to the correct year/month/day archive.- When moving or trashing a page, the module will automatically clean up empty year, month and day archives.How to create an archiving rule1. Go to the Setup -> Date Archiver screen in the ProcessWire admin.2. Click on Add New Archiving Rule.3. Specify the template that should be archived (typically the news-item template).4. Specify the Datetime field that should be used to determine the date to archive by.5. Specify the template that should be used for creating year archives.6. Optionally specify the template that should be used for creating month archives.7. Optionally specify the template that should be used for creating day archives.8. Click Add Rule.Tips and tricks- Configure the archive templates that will contain other archives to sort its children by name.- Configure the archive template that will contain the news items to sort its children by the specified Datetime field.- You will improve usability if you dont allow the user to create date archives manually.How to Install1. Install the module by placing ProcessDateArchiver.module in /site/modules/.2. Check for new modules on the Modules screen in the ProcessWire admin.3. Click Install for the Date Archiver Process.Module download:https://github.com/u...hive/master.zipModule project:https://github.com/u...ssDateArchiver/ 13 Link to comment Share on other sites More sharing options...
ryan Posted January 4, 2013 Share Posted January 4, 2013 Some very impressive functionality here! Thanks for your efforts here. Nicely coded and documented too. Please add to the modules directory when you get the chance. Link to comment Share on other sites More sharing options...
geniestreiche Posted January 11, 2013 Share Posted January 11, 2013 i ran into an problem when i try to install the module. downloaded the module -> copied the file into the modules directory. when i look for new modules in the backend this error messages pops up: Parse Error syntax error, unexpected '[' (line 367 of /var/www/lupo/site/modules/ProcessDateArchiver/ProcessDateArchiver.module). Line 367 begins with $this->fuel('breadcrumbs')... public function ___executeAdd() { $this->setFuel('processHeadline', $this->_('Add Archiving Rule')); $this->fuel('breadcrumbs')->add(new Breadcrumb('./', $this->getModuleInfo()['title])); return $this->renderRuleForm(); } /** * Executed when ./edit url for module is accessed. * */ public function ___executeEdit() { $this->setFuel('processHeadline', $this->_('Edit Archiving Rule')); $this->fuel('breadcrumbs')->add(new Breadcrumb('./', $this->getModuleInfo()['title'])); return $this->renderRuleForm(); } greetings Link to comment Share on other sites More sharing options...
Soma Posted January 11, 2013 Share Posted January 11, 2013 Looks like the php version required is 5.3 here. What do you have? Link to comment Share on other sites More sharing options...
u-nikos Posted January 11, 2013 Author Share Posted January 11, 2013 Thanks for the report geniestreiche, I've removed the function array dereferencing from the module as it is only available in PHP 5.4+. Could u test if everything work now? Link to comment Share on other sites More sharing options...
Soma Posted January 11, 2013 Share Posted January 11, 2013 Who uses php 5.4. Seriously I wouldn't be able to use this module and many others too. Thanks for removing it. Link to comment Share on other sites More sharing options...
geniestreiche Posted January 12, 2013 Share Posted January 12, 2013 thanks u-nikos for downgrading to php 5.3 it works fine now but when i submit a new rule i become a site-not-found error because the module directs to a wrong url. in my local environment it calls localhost/processwire/setup/date-archiver/. the right url would be localhost/pw/processwire/setup/date-archiver/. Link to comment Share on other sites More sharing options...
u-nikos Posted January 13, 2013 Author Share Posted January 13, 2013 Who uses php 5.4. Seriously I wouldn't be able to use this module and many others too. Thanks for removing it. Yeah I didn't really think about version compatibility, will try to do so in the future thanks u-nikos for downgrading to php 5.3 it works fine now but when i submit a new rule i become a site-not-found error because the module directs to a wrong url. in my local environment it calls localhost/processwire/setup/date-archiver/. the right url would be localhost/pw/processwire/setup/date-archiver/. I've changed the $session->redirect argument from $page->path to $page->url, so it should be fixed now. Link to comment Share on other sites More sharing options...
Marty Walker Posted February 1, 2013 Share Posted February 1, 2013 If I have a reasonably long list of news items do I have to go and save each one individually for this module to sort them into each year? Link to comment Share on other sites More sharing options...
u-nikos Posted February 1, 2013 Author Share Posted February 1, 2013 Hey Marty, No need to do that manually, you can put a little snippet in one of your templates to save the pages automatically (be sure to remove the snippet when you're done). Here is a little example: <?php foreach ($pages->find('template=news-item') as $item) { $item->save(); } ?> Link to comment Share on other sites More sharing options...
Marty Walker Posted February 2, 2013 Share Posted February 2, 2013 Outstanding. Thank you u-nikos! Link to comment Share on other sites More sharing options...
doolak Posted February 5, 2013 Share Posted February 5, 2013 Just had a look at the modules and found this one - great addition, thanks! I was about to build an news-archive and this module seems to do exactly what i need. Just one question... Before I found this module I already had prepared this pagetree: News (not-viewable) - Recent News (template = news_overview) - Lorem Ipsum (template = news_article) - Dolor Sit (template = news_article) - Archive (template = news_overview) The whole pagetree is shon on the page as dropdown - one can just klick "Recent News" and "Archive". In the archive i planned to have an overview of the passed years. Now i installed the module, choose the template "news_article" to be archived and the template "news_overview" as year archive template. After i saved an article the page "2013" was added under "News", the page "Archive" was deleted. Should this be like this? I guess the module works in the way it will place the archive pages under the same parent where the template exists, which is chosen to be archived - but should an existing page be deleted? One more question: Is it possible to have the actual year news items listed under a defined page, e.g. "Recent News" and just the items of the passed years listed under a page which is named like the year? Link to comment Share on other sites More sharing options...
doolak Posted February 5, 2013 Share Posted February 5, 2013 Forget the second question, please! That sorting is fine as it is - i forgot that if i want to display the recent years items under "Recent news" that can be easily done through the API... ;-) Link to comment Share on other sites More sharing options...
u-nikos Posted February 6, 2013 Author Share Posted February 6, 2013 Hey Doolak! Yes this is intended behaviour. I'll explain what the module does: 1. When a page is saved with the news_article template, the module will find the first parent page that isn't a year/month/day template (in this case: News). 2. Then it'll create the year/month/day templates under that parent page, and move the news_article into it (in this case: it'll create the 2013 year archive under News, and move the Lorem Ipsum news_article into it). 3. After the news_article is moved, the module will cleanup empty year/month/day archives (in this case: it'll delete the Recent News and Archive pages because you've told the module that they are year archives, and they are cleaned up because they're empty). If you want to retain the Recent News and Archive pages, you should create an different template for the year archives, like "news_year_archive" and tell the module to use this template for the year archives. Little example: - News (template=news) - 2013 (template=news_year_archive) - Lorem Ipsum (template=news_article) - Dolor Sit (template=news_article) - Recent News (template=news_overview) - Archive (template=news_overview) Although I'm not sure if you really need the Recent News and Archive pages (because News could already show the recent news, and the 2013 page is already an archive), but I hope this helps u Link to comment Share on other sites More sharing options...
antknight Posted February 21, 2013 Share Posted February 21, 2013 (edited) This is a very handy module, thanks! How would I output an archive list in a template. For example a list of years and months and a link to a list of news items? Edited February 22, 2013 by antknight Link to comment Share on other sites More sharing options...
Marty Walker Posted March 4, 2013 Share Posted March 4, 2013 Sorry for the cross-post but I have a problem whereby I can't move a page out of the Trash into a section of the page tree using PDA. My only way around it is to change the page template, move it then, change the template back. Wondering if this behavior is expected or not. Link to comment Share on other sites More sharing options...
ryan Posted March 4, 2013 Share Posted March 4, 2013 Sorry for the cross-post but I have a problem whereby I can't move a page out of the Trash into a section of the page tree using PDA. My only way around it is to change the page template, move it then, change the template back. Wondering if this behavior is expected or not. In cases where a drag-drop isn't supported (like on a cellphone, tablet, etc.) you would edit the page, click to the "settings" tab, and change the parent from there. If it still doesn't let you put it where you want to, you may need to adjust the family settings of the relevant templates. Those family settings in each template optionally control where pages will be allowed to ultimately live or be moved to. Link to comment Share on other sites More sharing options...
Marty Walker Posted March 4, 2013 Share Posted March 4, 2013 Hi Ryan, This all in desktop browsers. I thought of the 'family' settings and removed that first up. Moving that page out of the Trash still didn't work. My fix was to change the page template (and the one used in the Date Archiver settings) and then move it out, change the template back to the original - and in doing that the Date Archiver finds it and shuffles it away. Link to comment Share on other sites More sharing options...
ryan Posted March 5, 2013 Share Posted March 5, 2013 Strange I wonder what was blocking it from coming out of the trash. If it wasn't the family settings, I really don't know what it could be. But if you find it turns up again, let me know. Btw, when you said PDA, I thought you were talking about an old school mobile device or something. Link to comment Share on other sites More sharing options...
antknight Posted May 4, 2013 Share Posted May 4, 2013 (edited) Hello, I was just wondering, in the tips you mention '- You will improve usability if you dont allow the user to create date archives manually.' Can you elaborate on what you mean and how to go about it? Is it done with the family or access settings for each template? Thanks Never mind I figured it out. Thanks again for this module. Edited May 4, 2013 by antknight Link to comment Share on other sites More sharing options...
RyanJ Posted November 15, 2013 Share Posted November 15, 2013 I am trying out your module as a solution to my question here and it works great for archiving. Thanks for sharing it. I did have one question though. Using your example structure above, I noticed that if the year "2013" page is already created in the tree structure and if you would go to create a new article page under the "News" a new "2013" is created and the new article is placed under that page instead of the already created "2013" page. News - 2013 -- Article I know the logical sense would be to create a new article under the 2013 page, but users may become confused by that. Is there a way to check if an archive date page is already created under its current parent? If so, to place that new article in the already created one, if not then create it? Link to comment Share on other sites More sharing options...
Marty Walker Posted January 19, 2014 Share Posted January 19, 2014 I have a suggestion because I tend to re-use templates for other purposes (eg: a news-list template can be used for a blog-list too). Is there a way to exclude a template from the module workings based on a certain page name or page parent? Link to comment Share on other sites More sharing options...
JasonS Posted March 2, 2014 Share Posted March 2, 2014 Forget the second question, please! That sorting is fine as it is - i forgot that if i want to display the recent years items under "Recent news" that can be easily done through the API... ;-) Hey, I'm fairly new to PW so i'm trying this module which seems to do what i need. But to the deletion or rather renaming of existing pages to year it is messing with my menu layouts. How can i have each category achieve under it's own page head. Home - Category 1 -Year 2014 -Page 1 - Category 2 -Year 2014 -Page 2 Right now it changes my structure to Home -Category 1 {unpublished} - 2014 -Page 1 -Page 2 Which in my opinion isn't very user friendly of navigation, if i have my menu markup based on second level pages (From Home).\ If i can get any assistance, i would greatly appreciate it. Link to comment Share on other sites More sharing options...
ilezia Posted March 24, 2014 Share Posted March 24, 2014 Great module but I have a little problem. I have a news article template named "news_item" which has title, date, text and image fields. On my news page I'm allowed to create new children with the news_item template. I've further created templates for news_year, news_month and news_day. These are empty templates with just the title field. I've set-up the Date Archiver for the template "news_item" to use its date field as the date, and to use each of the news_year, month and day templates as per. However, now when I create new news items they get archived correctly up to the month but for the day a new page is created every time resulting in duplicates. E.g. if I posted two articles today they would be archived: news/2014/03/24/article news/2014/03/24-2/another-article (although 24-2 is still displayed as just 24 in the page-tree) Furthermore the day page is created using the month template even though it's been set-up to use the news_day template. Is there something I'm doing wrong? Link to comment Share on other sites More sharing options...
hellomoto Posted July 15, 2014 Share Posted July 15, 2014 Great module but I have a little problem. I have a news article template named "news_item" which has title, date, text and image fields. On my news page I'm allowed to create new children with the news_item template. I've further created templates for news_year, news_month and news_day. These are empty templates with just the title field. I've set-up the Date Archiver for the template "news_item" to use its date field as the date, and to use each of the news_year, month and day templates as per. However, now when I create new news items they get archived correctly up to the month but for the day a new page is created every time resulting in duplicates. E.g. if I posted two articles today they would be archived: news/2014/03/24/article news/2014/03/24-2/another-article (although 24-2 is still displayed as just 24 in the page-tree) Furthermore the day page is created using the month template even though it's been set-up to use the news_day template. Is there something I'm doing wrong? I'm having the same issue, but I'm only using the year -- and using PW v2.4, which isn't specified as compatible anyway... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now