4

I'm looking to display a weekly events calendar. I've set up content type event and added a starting day field. What I'm essentially looking for is this:

Weekly Calendar Block

So the interface is a tabbed one, so as long as I can get the current week and its events grouped by date I should be fine, but I need to be able to pull future weeks via ajax in a manner the Calendar View does. So the question is this: can this be done with some Calendar View template? How can this be put together with views? I tried to modify the Calendar block provided as Views Template, but all I ended up was a monthly block.

Thank you in advance.

2
  • Are you looking to do this in a block?
    – mlibjh
    Commented Oct 18, 2012 at 22:57
  • @mlibjh Preferably yes, but any solution will work. I'm not picky :) Commented Oct 21, 2012 at 9:12

2 Answers 2

3
+50

You can do something quite close to that with views. When you set up your view (or just use the one that comes with the Calendar module and clone it and start editing your new copy).

Just make sure you go to the Calendar settings and choose 'Week' as your Calendar type:

enter image description here

enter image description here

Of course, you have to choose which fields to display for your event type and here's what you'll roughly end up with:

enter image description here

I've added css to my theme to change the look of this calendar page, and that's probably a separate topic. Most of the functionality you want is available through the calendar module... just set your type!!

Hope this helps.

================= EDIT =========================

So, after reading your comment, here's how I'd modify the solution above. Same calendar, but choose 'Day' as the calendar format. Then under the 'Header' section, add a Header and choose "Global: text area". Here, using php, we can output links to how many ever days you need before and after today's date... since this doesn't happen automatically. You'd need to enable the php filter module to make this possible.

So, using the 'php filter' format for the global text, you can add the following code (I would check it to display even for empty views...):

<?php  
print( "<a href=" . date('Y-n-j') . ">" . date('l') . "</a> | "); 
print( date("l",strtotime("+1 days")) . " | ");
print( date("l",strtotime("+2 days")) . " | ");
?>

The above just prints out today's week day, then tomorrow and the day after. You can change to suite your needs. I've also only printed the first one as a link. You see, the day calendar format can be navigated by just going to /2012/11/23 to get to Nov. 23rd of this year, etc. Very easy to figure out the links, so you can build your own menu using php in the header.

This is the output you'd get, and of course, you can always beautify with css: enter image description here

6
  • thanks, this is what I did previously, but as you can see one of the problems is that the month appears at the top and not a date or week, and the other is the calendar layout. I need it to be just a simple list of events. Commented Oct 23, 2012 at 11:21
  • Oh, I'm sorry. I think what may be confusing folks is your statement "...but all I ended up was a monthly block." It seemed to me that you simply weren't aware that you can change to a weekly. Sorry for the misunderstanding. I'll see if I can think of a way to get it closer to what you want... Commented Oct 23, 2012 at 13:13
  • I've edited my response above... Sorry if that's not quite what you need, but I think it's at least a little closer and may give you some ideas... Commented Oct 23, 2012 at 13:50
  • Thank you @Boriana. This got me much closer, although, I must say, I'm ending in writing a completely separate module for this. Just couldn't get along with the Views options. I'm upping your answer so you can get the bounty and will post a link to my module, once it's done. Thank you again for all your help. EDIT: Oh I was able to award the bounty without checking your answer as correct one. Cool. Commented Oct 25, 2012 at 6:31
  • Wow, and you've even decided in writing your own module? You should definitely put that as an answer when you're done because it seems like a layout that many folks would be interested in using! Good luck! Commented Oct 25, 2012 at 13:02
0

You must use views module with Calender module, see this video to learn how to do it, but after you fishing creating your calender view you must make some CSS changes.

1
  • Yeah, thanks @abd, this is what I've been using, but the available block defaults to monthly view. When I change that to weekly, it still displays the months, but without the events. What I'm actually asking is the correct procedure to create such a View with Calendar module. The CSS and the jQuery won't be a problem once I'll be able to pull the View correctly Commented Oct 14, 2012 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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