Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By chunty on
I want to create a block with an archive of the format:
- 2011
- 2010
- 2009
Clicking say 2011 would then give me all posts in 2011 and then the block would show:
- 2011
- December
- November
- October
- etc
- etc
- 2010
- 2009
Clicking say november would give me just posts for Nov 2011. I know how to make the view to filter the posts but I don't know how to create the grouped expandable block, can anyone help
Chris
Comments
=-=
http://drupal.org/project/views = has within a default archive view
else see: http://drupal.org/project/archive
Close but no cigar!
Thanks for your response - I thought I might get this answer. Yes it does but that not grouped by year as far as I know so you'll get
I'm looking to have it grouped by year - do you know how to do that?
Chris
=-=
clone the view, edit the date field it's grouping on to do so by year.
Can't see how
I hope you don't think I'm taking the mick asking all these questions but I can't see a way to set it by year - would you be to provide step by step instructions?
C
=-=
I have no pre-conceived notions. At moment I can't provide a step by step as it's a holiday and I'm not where hear an install to look at the view.
edit: I set up a quick test site.
Add a new contextual filter (content: year)
delete the default contextual filter (content: year + month)
save the view
test
Ah right you're in the US (no
Ah right you're in the US (no holiday for us in UK)
I really appreciate the help, yup I've got that far - I can make the view but not the block with the filters - this guy has managed it here http://deglos.com/blog but I can't figure out how, tho he may have built it custom.
I've been through this http://www.latenightpc.com/blog/archives/2008/09/28/replacing-the-wordpr... with a pretty fine tooth comb but all it does is give you view not the block
If you get any more inspiration let me know, and I figure out how I'll post it back.
C
=-=
The block is a block display. similar to that in the archive view.
I'd assume its grouping on year and on month.
Evidentially, i'm not understanding exactly what the trouble is at this point.
Sorry I worded that badly
Ok let me rephrase that
It's not that I can't make the block (I realise this is just another way of displaying the same thing). Its that I can't get the grouping by month and year to work...
Evidentially I'm not really understanding how you have manage to make it work :)
Chris
=-=
I didn't group by month and year. I thought you had the month part worked out so I only worked on a way to handle year which is what I thought you were having trouble with
so you need two contextual filters
first one year
second one month
Yup I got that but that gives
Yup I got that but that gives a list of years then when you click on the year the years disappear and are replaced by months so for example you get
2011
2010
2009
If you click through on 2010 you'll then get
Dec
Nov
Oct
Etc
But you won't get
2011
2010
- Dec
- Nov
- Oct
- Etc
2009
Does that make sense....Sorry dude?
The answer!!
Right the answer to this question is that you can't do this without your module code or function :)
However there is a module out there which can.... http://drupal.org/project/wp_blog
Simple as that :) ...shame it took me 2 days to figure this out
C