Howdy Folks,

I put together a website for a local gym. They post a workout everyday for their group classes that gets displayed in a block on the right side of the page. The workout is a separate content type made with cck. The fields are pretty simple: title, workout date, and body (containing the text of the workout). Right now, I have the block set up to only show one day at a time with no pager at the bottom. Pathauto creates an alias that looks like wod/[yyyy]/[mm]/[dd]/[title-raw] where the year, month, and day all come from the custom date field in my content type.

Here's what I'd like to do: create a page where users can view the archived workouts and also navigate through them using hackable urls.

Here's my problem: when using the arguments in Views, I cannot access the portions of the workout date as I can the portions of a posting date. For example, when making hackable urls, you can just use the month or day portion of the posting date. Right now, I either get the whole workout date field, or nothing. Any ideas for me? Thanks in advance.

Comments

laceiba’s picture

I'm sure someone has run into this same issue. Any ideas?

ishmael-sanchez’s picture

You mention a CCK field called workout date is that using the date module, http://drupal.org/project/date. If not I would try using it because it expose information that can be used with views. Otherwise you might have to write some thing custom for this functionality.

laceiba’s picture

I have the date module installed. I forgot to include that in my post above. Sorry about that.

laceiba’s picture

Anyone else? I may post this over in the Date forum, but I wanted to check here first. Thanks in advance.

ishmael-sanchez’s picture

If you have views installed take a look at the default archive view. You might want to clone the view and play with the arguments because just playing with the view I get semi hackable URLs (http://example.com/archive/2009 and http://example.com/archive/200909). I think that might be a good start for you.

laceiba’s picture

The archive view is not the answer, unfortunately. That relies upon the node's posting date which is conveniently broken into month, day, and year variables for use in Views. Dates created with Date+CCK (which are what I would like to use) do not seem to enjoy this treatment. I am wondering if there is a way around this issue.

kolafson’s picture

I also want to use a CCK date field in this way. You can have URLs like /blog/2010-11-4 bring back everything for a specific date, or 2010-11 for a month, but slashes would be better than hyphens which are unintuitive.

chadchandler’s picture

Try creating a view with node style:nodes a path of blog/archive

Add a 'Date' argument to the view and select the date-field that you want to use, with day granularity.

Action to take if argument is not present: Display all
Validator options Display All

So, say your CCK Date is Feb 17, 2011 --- navigating to yourwebsite.com/blog/archive/20110217 will display all nodes with your date.