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

VM’s picture

http://drupal.org/project/views = has within a default archive view

else see: http://drupal.org/project/archive

chunty’s picture

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

  • Dec 2011
  • Nov 2011
  • Oct 2011
  • etc
  • etc

I'm looking to have it grouped by year - do you know how to do that?

Chris

VM’s picture

clone the view, edit the date field it's grouping on to do so by year.

chunty’s picture

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

VM’s picture

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

chunty’s picture

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

VM’s picture

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.

chunty’s picture

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

VM’s picture

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

chunty’s picture

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?

chunty’s picture

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