All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

What if my URL doesn't have a date in it?

Rick 13 Oct 2012 13:11 question, complete

Hi there. I'm wrestling with the calendar tag of low_events; as usual my problems stem from a lack of me understanding quite how it works rather than from any problem with the add-on, so here I go with more questions.

My situation is this: all of the examples I've seen draw their date parameter from a URL segment (I'm dealing with the calendar tag at the moment, but this is also equally true of the this_date, next_date and prev_date tags). I want to use the calendar tag on a page that doesn't have a date component in its URL (my events/index.php page). I had initially specified the date parameter by using {this_month_url} which seemed to work. However, I tried adding a second calendar on the same page with the date set to {next_month_url}, and it is also showing *this* month, so clearly that parameter is not working after all and the tag is simply falling back to today's month as a default. So here are my questions:

1. Can the calendar tag be used on pages that don't have a date in the URL?

2. If so, how should I set the date so that it reflects whatever the current month is (or, similarly, whatever the next month is)?

3. Is there a way to use the calendar tag in such a way that I can create 'next month' / 'prev month' buttons that will load the appropriate calendar -- perhaps by changing the embedded variable for an embedded template? Of course, this might be far simpler if it involved simply changing URLs (with date segments) but, again, I'm looking to load a calendar into a page that has no date in its URL.

Many thanks, as always.
Rick

Replies

  1. Low 13 Oct 2012 19:55

    If no date-parameter is given, today is assumed. This is true for all tags with a date-parameter.

    So far, you can't natively enter a value for 'next month' in the date parameter. You'll have to create that date using PHP on input, similar to the start_on parameter in the channel entries tag. Just beware of the correct format for Low Events.

    You can't use {exp:low_events:next_date} as a value for another tag's parameter.

    As for your last question; that looks like something for Ajax, where a click on the next-month link would fire an Ajax request to the server, fetching the calendar for that given month.

    Does that shed some light?

  2. Rick 16 Oct 2012 14:31

    Thanks for the reply Low (and again, sorry for responding to it several days later). I partly solved my problem and worked around the rest of it. I realised that I wanted to have a calendar appear on the event-specific (single-entry) template, a page that doesn't have a date in the URL (events/view/url-title-for-entry). But I managed it with an embedded template, since almost the whole page is essentially one big channel:entries loop with a low_events date-picker field in it. So I could grab that date and pass it to the embedded template to specify a working date for the calendar.

    Many thanks for your help with all my questions; it's always invaluable -- even when it's just telling me that I can't do something in the way I'm trying to.