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

Support archive

monthly listings with nav using Ajax

stevieg_83 3 Jun 2013 14:50 question, complete

Currently in the process of replacing Solspace Calendar with Low Events.

Have a little bit of AJAX functionality to skip between the events for a given on http://www.greenviewevangelicalchurch...

Tried to replace the month nav tags with:


<!-- / month_nav -->

and then replace the entries listing with

{exp:low_events:entries channel="low_events" unit="custom" date_from="now" date_to="{segment_3}-{segment_4}" status="not closed"}
{if no_results}No Results{/if}
{low_events_details:start_date format="%M"}{low_events_details:start_date format="%j"}
{title} - {low_events_details:start_date format="%g:%i %A"}
{low_events_summary}
{/exp:low_events:entries}

The nav tags work fine at first glance but if we skip to July, the prev remains set to May and the next is set to 1970/02

Replies

  1. Low 3 Jun 2013 14:59

    This is how I prefer to do monthly listings, taking your URL structure into account, where its /events/YYYY/MM (looks like you're targeting segment 3 and 4, which is the month and an empty segment):

    {exp:low_events:entries 
    channel="low_events"
    unit="month"
    {if segment_2}date="{segment_2}-{segment_3}"{/if}
    status="not closed"
    }


    For next/prev month URLs, use something like this, which should give you a YYYY/MM format to use in your URLs.

    {exp:low_events:next_date 
    {if segment_2}date="{segment_2}-{segment_3}"{/if}
    unit="month"
    format="%Y/%m"
    }

  2. Low 3 Jun 2013 15:03

    Actually, this also looks like a nice job for a preload replace var:

    {if segment_2} 
    {preload_replace:pre_date="{segment_2}-{segment_3}"}
    {/if}
    {preload_replace:pre_date=""}


    ...and then use the variable {pre_date} in your templates for the date="" parameter. It will be the given month when there is one, or an empty string (which will default to now) when no month is given.

    Then you only have to use the conditional once, which is nicer, I think.