2

I am looking for a solution which displays node list within the date range. Requirement is to display events from today to next 6 days group by date. I have a content type "Agenda" with a date field enabled. So the display should look like:

2 Jan 2012
-- 8:00 AM Agenda A
-- 9:00 AM Agenda B
3 Jan 2012
-- 8:00 AM Agenda C
-- 9:00 AM Agenda D
4 Jan 2012
-- 8:00 AM Agenda..
-- 9:00 AM Agenda..
5 Jan 2012
-- 8:00 AM Agenda..
-- 9:00 AM Agenda..
6 Jan 2012
-- No events scheduled
7 Jan 2012
-- No events scheduled

I tried with the Views module and the Calendar module also, but I don't want to display in calendar style format, and I need to display only these 6 days (now +6 day), not the entire month view. Other styles are not fulfilling my requirement.

Here I have display 6 dates and display node/event associated with its otherwise display "No events".

Could you please suggest something?

3

I'm assuming you know how to filter the view to get the nodes based on the date and date + 6, but are having troubles grouping them together on output by date.

I see you are using D7, but to do this in D6, you would add the date field twice in the view and override one of these with a template to output just the day in question and group on that now simplified field.

A good article on that is http://drupal.org/node/388140 which shows you how to do it by month; to do it by day just change the date function to include it as well.

I would imagine D7 is very similar, and that this helps out.

  • Thanks for help. Here nodes are grouped on content:date field, associated with the node. As you can see for dates 6th & 7th Jan there is no node. Basically this grouping shouldn't be on content:date field but on the static dates like from now to now + 6. Any hint? – Asif Mulla Jan 3 '12 at 5:45
  • you'd have to edit up a views template to output the '--No events scheduled' text if the row was empty. – Jimajamma Jan 3 '12 at 5:48
  • As there is no node having 6 and 7 Jan as content:date then view doesn't return any records. It returns records for 4 dates 2,3,4 and 5 Jan. So inside template I couldn't check empty row. – Asif Mulla Jan 3 '12 at 6:06
  • Hmm. Grr. I was thinking you were getting the 6 and 7 Dates there, at which point you could munge up something, but if not, and you are getting nothing, you will have to get really creative; unfortunately, I am not thinking of anything right off the top of my head. – Jimajamma Jan 3 '12 at 6:20
  • Of course, in the "crude but effective" arena, you could create 6 view displays, one per day, and iterate through each, printing the empty text if no events occur on that day... – Jimajamma Jan 3 '12 at 17:01
1

I agree with Jimajamma's answer, since we have done something similar in DT.

We needed day of the week and time of day

Basically, we had two date fields in our view, one we altered the date format to show only the time, the other one we altered to show only the day of the week. (You can do this in the settings for the field.)

We then altered the Format settings of the view by clicking the settings link next to fields under the FORMAT header and grouped the results by the field showing the day of the week.

Finally, we excluded from view the field showing the day of the week (to avoid duplicated entries in the view)

Also, on one final note, to ensure that we did not get duplicate entries on the view, we used the distinct function. You can do this by

Expanding the "Advanced" section of the view admin

Clicking on "Settings" next to Query settings- this is under the OTHER header

Checking the box for "Distinct"

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.