Hello,
I've scoured drupal.com for info on this but haven't found anything exactly like what I'm looking to do in views:
A block containing a list of year links to content. Click a year, get a list of month links, click a month get a list of day links. Each click results in the view page being refreshed with the content appropriate for that date selection. Effectively a year/month/day drill down.
Using D6, and Views 2, here is what I already have:
Views: Block: Arguments:
- Node Created Year : Summary, sorted descending
- Node Created Month : Summary, sorted descending
- Node Created Day : Summary, sorted descending
It works by showing the year, but when I click a year, I don't see a list of months... make sense?
I also want my path to be: news/year/month/day not: news/yearmonth (which is a common suggestion)
Thanks for any help to point me in the right direction!!
Comments
It's not exactly what you
It's not exactly what you want, but I'd start looking at how the Archive module does things. Conceptually you and they are working along the same lines.
Are you looking to implement this in a page or a block? The title says block but then you refer to a page later on.
Way to create the block of drill-down Year > Month in drupal
Hello,
I was looking for this solution too. It seems like a common need. So I thought I would post the somewhat hackish solution I came up with (I am still a drupal newB, so it is likely that this isn't a great approach):
1. Copy the archive view that ships with drupal, as a starting point
2. Open the block display
3. In the arguments section:
4. give your block a machine name (e.g., news_archive)
5. Add the following to your template's template.php
6. Then add something along the lines of the following in tpl file for that block. I am using the JQuery UI Accordion function to create the drop-down lists of months, after someone has clicked on a year. Though another UI approach I'm sure would work just as well.
Conceivably, you could just add the day argument, and add get the month variables in the preprocess, and repeat to be able to drill another level for the Created Day.
Hi mak, I am not sure where
Hi mak,
I am not sure where to put step 6 code.
and can you please explain what is "your_archive_view" and "your_archive_view_display_name" in step 5
Thanks in advance.
machine names of view and its related displays
"your_archive_view" = the "View Name" you gave your view when you created (i.e., the machine name of the view you created). You did this in step 1 when you cloned the Archive view that ships with Drupal. Basically to embed a view you are calling that view by its name. This can be any type of view. We just happened to be creating an "archive" with our view.
"your_archive_view_display_name" = the name of the block display that you added to the above view (step 2). You can define the name of the display by opening that block/display within your view, and then under Basic Settings: Machine Name give that block a name. Otherwise it will be some generic name applied by drupal (e.g., Block_1 or something).
Thanks mak, My view name
Thanks mak,
My view name "testarchive" and and block display name is "test_archive". However I couldn't find Machine name in basic setting and I am assuming Display name as Machine name (I am using Drupal 6.24).
Now I have putted step 5 code in my theme's template.php.
Now where to put step 6 code.
it works.
it works.
thanks a lot
thank u
https://www.drupal.org/project/image_captcha_indicator
https://www.drupal.org/project/ext_js
Does this work in Drupal 7?
I followed the instructions but I'm getting this error:
Notice: Undefined variable: block in include() (line 6 of /Applications/MAMP/htdocs/mysite/sites/all/themes/mytheme/views-view--my-archive-view--block-1.tpl.php).
Durval Tabach
Views nested Accordion
I found Views nested Accordion to work with this type of Year to Month drill down. The key was to include Content: Post Date as a field as many times as there are levels in your archive. For me, it was only twice for year and month. Then, I set a custom date format for each of these field types: Y for Year and F for Month. Be sure to group each level by the appropriate Group field number. With this approach, contextual filters aren't necessary.