Jump to content

Recommended Posts

Posted

I'm building an event-calendar with php, ajax and js.

I want it to show a monthly overview when I click on a "month" button or when I switch the month. 
And show the events on one particular date when I pick a day. 
Also, most events are kind of exhibitions and so they have a start date and an end date much later, and occur on each day in-between as well.

So on the template I put two date picking fileds date_start and date_end

Is there an elegant way to select the events using the API? 

Because right now I'm pushing around and storing the pages (events) in arrays, looping through them a couple of times, using the AJAX-variables in if-statements to compare with. It kind of worked already but showing the events on the dates between start and end as well adds another level of difficulty and I wonder if so many loops would be scalable. 

I tried: 

$items = $page->children->filter('date("Ym", date_start)=$y.$m');

doesnt't work XD

Any advise?  

 

 

Posted

You can filter by dates like so:

$events = $page->children('limit=50, date<=today, sort=-date');

Also check this thread to see more details:
 

date_start>=today
date_start>=1365436783
date_start>=2013-04-08
date_start>=4/8/2013
date_start>=8.4.2013
date_start>="April 8, 2013" 

 

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...