2

Here is another calendar related question: I want to create a link-item that links to a view that filters events to the current date. Easy, you say?

Right now i have a mini-calendar block that show the current month and a view (type page) for events that has a contextual filter: Date: Date (node). It provides the default value Current Date if the filter value is not in the URL.

This works fine. The view shows the events for the current date when the /events page with the view is visited for the first time (no filter value in URL).

So, if the mini-block with the month view is used, it shows the events of that day accordingly. But if someone cycles through the months and wants to go back to show events of today he has to click back to the current month and date to show them.

Now i want a link-item that links to the current date view as a kind of shortcut, visible on all event-views, but i have no idea how to do that.

Right now i have my view duplicated, with an own path (/eventstoday) and a block with the link to that view, shown on event-view pages.

But there must be a way to achieve this with only one view...

Any help would be appreciated... and thanks for reading!

EDIT:

Additional Information about settings used: I use Ajax in the views and also the calendar configuration option: "Track current date in session" for all users.

Store session information about the user's current date as they move back and forth through the calendar. Without this setting users will revert to the current day each time they choose a new calendar period (year, month, week, or day). With this option set they will move to a day that conforms to the time period they were viewing before they switched. Requires session tracking which is not ordinarily enabled for anonymous users.

I use Drupal 7.14 and the latest development-snapshots of calendar, date, ctools and views.

  • Are you using AJAX in the view? Are you using Drupal 7? – Capi Etheriel Jun 29 '12 at 0:25
  • I updated my question. – Volker Jun 29 '12 at 7:48
4
+50
<a href="event/<?php print format_date(time(), 'custom', 'd f y'); ?>">Event of today</a>

Do something like this in the calendar theme. Change the path and the format API and put it in one of the tpl.php file of the calendar.

Or just put a link on the tpl.php, pointing to the default view without date on the url

<a href="event">Event of today</a>

Where do you want to put it?

0

You can just do that by adding the static link into the footer area of the view. To have it work on all URLs that display your view use:

<a href="/event">Today's events</a>

No need to use a block or a second view.

0

Create a view having in a field whatever you have taken for the Calendar module. Then use "Rewrite result" in the view to create a link.

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.