Predicate Functions

In addition to all the normal functions provided by XPath, VaeQL also provides a few functions of our own that are useful for searching:

  • now() - returns the current day. Useful for finding current vs. past events.

  • clubtime() - like now(), but treats the time from midnight-3AM as the previous day. Good for creating band or nightclub websites.

  • date($date) - special function that selects entries where the date value is within a certain year, month, or day. If $date is just a number, it is interpreted as a year and all entries from that year are returned. If $date is formatted like 2010-01, it is treated as a month. If $date is formatted like 2010-07-23, it is treated as a day.

  • loggedin() - returns the ID of the currently logged in user.

  • path() - returns the URL path of the current page.

  • top() - returns the ID of the current context.

Here is an example of searching for events that are upcoming:

<v:collection path="events[date>now()]">
 ...
</v:collection>