By Sub Rosa on
So one of my "primary links" is http://www.site.org/archive where I have the calendar/archive block enabled.
When you clink that link, you get "No Posts Found". I had assumed that "/archive" would default to the current date, but that doesn't appear to be the case.
Is there a way to redirect /archive to /archive/2006/5/25 (or whatever the current day is)?
Thanks.
Comments
Fixing the date
Read through this post. It explains how to fix the archive module to reflect the date.
http://drupal.org/node/44765
I'd really like to see this using current date and install date variables or allowing for a settings option, but that might be a bit much. Someone could always write a little patch. :-)
If you're lazy, here's a recap of what was said:
kayman - January 16, 2006 - 17:52
Open archive.module and find the following line:
// Prepare the values of the form fields.Under that, you'll see two dates. I changed mine, so I can't remember exactly what they were -- but from your post, I'd guess they are 2000 and 2005. I changed mine to 2006 and 2006 and that worked for the click-down menu archive form (so far). Here's what my line looks like:
$years = drupal_map_assoc(range(2006, 2006));I'm a fan of BoyouBill's fix:
BayouBill - March 6, 2006 - 15:42
Change this line to read:
$years = drupal_map_assoc(range(2006, date('Y')));Replace "2006" with the year in which the first content was added to your site. Then the archive module will always display a year range that runs from the inception of your site to the current year.
//---------------------------------------
Latenightdesigners.com- Giving IMD a Fighting Chance
Not quite what I was needing
Okay, so that section of code seems to allow me to mess with the values displayed by default in the form items (year, month, & date pull-down boxes) on the archive page.
What I need is for that default date to be submitted (or processed) the first viewing of that page.
On my site, if you hit http://www.projectwhitenoise.org/archive you get "No posts found". I assume that's because, even though the form drop-down boxes have today's date selected, the query was never submitted. When you click "Show" you end up on http://www.projectwhitenoise.org/archive/2006/5/25 which finds the post I've made today.
So my guess is that /archive was never meant to be access directly, and only via the calendar box? Anyway, I was hoping to make the default /archive page realize that a date wasn't submitted and choose today's date by default.
Oh, My bad. :: blink :: I
Oh, My bad. :: blink ::
I must of been more tired than I thought that morning! lol
I don't see why you can't add in a SQL statement using the date function to grab the current date. It's a bit odd that it doesn't default as I remember mine used to in 4.6.x when I used it.
Silly me anyhow as it looks like they fixed this in 4.7.x
$years = drupal_map_assoc(range(2000, 2010));Looking at the output code though there are two of these:
I don't see why we can't change the last one to a SQL query of the current date...
//---------------------------------------
Latenightdesigners.com- Giving IMD a Fighting Chance