views:

20

answers:

0

Assume a collection of nodes that we want to display in a view. Like all Drupal nodes, they have a published-on date. Assume that we want to organize them by that published-on date.

Now, what I want is a page with TWO different navigation blocks.

One that looks like this, where each year is a link to that years' posts:

2006 | 2007 | 2008 | 2009 | 2010

... and a second one (dependent on the first one), where each month is a link to that months' posts:

Jan | Feb | Mar | Apr | Jun

I've figured out more-or-less how to do this, using Drupal Views and two different Block displays, one "Nav: Years" and one "Nav: Months".

Nav: Years has the Argument "Node: Created Year" and is setup to do "Summary, sorted ascending" if the argument is not present (the argument will never be present, because the display is a block).

Nav: Months has two arguments, one "Node: Created Year" and one "Node: Created Month". The "Node: Created Month" argument is setup to do "Summary, sorted ascending". However, the "Node: Created Year" one needs to have a default argument of whatever year is selected in the "Nav: Years" bar. I am not sure how to do this, but I think one way will be to set it to be "Provide default argument" / "PHP Code" and then use the following code:

return arg(0)

Now, with this setup in mind, I have a number of questions:

  1. When a user hits this view, I want the page to display the MOST RECENT month of the MOST RECENT year. Note that MOST RECENT in this case does not necessarily mean the CURRENT month, or even the CURRENT year. I am lost as to how to tell the page to do that (there is no default value for the "Node: Created year"/"Node: Created month" arguments that equates to "most recent")
  2. Is my idea (described above) for how to tie the "Nav: Months" block to the "Nav: Years" block workable?
  3. Is there any automated way to automatically set one of the links in the "Nav: Months" or "Nav: Years" block to "active" (i.e. to not be a link) when the user is already in that section? For example, when the user clicks "2008" in the "Nav: Years" block, it should send them to ./2008, which should result in the Nav: Years block updating so that "2008" is no longer a link, to show that is where they are.

Been working on this for a while now, and I'm fairly stymied. Any help would be appreciated!