With a lot of help from Kent and Matt, I think I have something interesting happening with my template. The formatting leaves something to be desired, but the functionality is getting pretty close.
I was looking to create a template cause the calendarscript to compile chronological list of events from a single calendar, but filtering them on certain constraints passed on the command line. Among the parameters were duration, country, state, maxevents..
Some of the command line arguments now working:
DURATION - Just the standard duration passed to the script to limit the list output to a certain number of days. If unspecified I made it default to my own value, and I made it also accept the number with and without the "d" attached. Usage is &duration=10 or &duration=10d. Note: if you ask for more than 365 days, I cap it at 365 just so my script doesn't spin its wheels forever.
MAXEVENTS - This is a parameter to constrain the printed list to a fixed number of events in case there isn't space in the page environment for more. I also created a default for this. Usage example is &maxevents=12. The default if unspecified is 25.
COUNTRY - This is filters on one of my custom fields, depending on the country where the event will occur. To make it more flexible, you can search on a list of countries in the command line. Usage example &country=USA,France,Belgium NOTE: if the country is unspecified, all countries match. If a STATE (see below) is specified, then the country defaults to USA
STATE - This filters on a second custom field in the database, the US state where the venue is held. If unspecified it doesn't filter at all. If any list of 2 or more characters is given as a state, COUNTRY defaults to US and the list will be searched. My custom field uses the US postal codes for US and territories, so valid searches would be on series of the 2-character codes, separated by spaces or commas so you don't get inadvertent matches, like CA,KS without the comma would be CAKS and match AK.
Sample usage &state=CA,CO,OR,HI
HERE ARE THE SAMPLES!
Now for some real examples on a database made up of 33 international events from various countries. Please note these search results are coming from the same template, just using different command-line arguments, which was the point!
1. Here is 365 days duration with no search terms. It caps out at a maxevents of 25(default) No terms matches all countries
2. Here is a 30 day duration
3. Here is a 365 day duration but with a cap of maxevents=10
4. Here is a 150 day search on events in California
5. Here is a search on events in France,Belgium,New Zealand and Australia with a maxevents=3 cap
6. Here is a hypothetical 365 day searchsearch on the coastal states of CA OR WA NY FL GA TX
Feel free to follow the links and experiment with changing the URL. I will be working on cleaning up the template and the code, but I think this demonstrates the functionality.
Your comments are appreciated!
Matt
[This message has been edited by memobug (edited January 11, 2002).]