John, Michel is very estute as always. :^) I use the Calendar tag to sort through 22,000 possibilities, and it's sub-second (Michel's Catalog rocks with indexes) The trick is to create a field_index on the date property, and any other property that you'll be qualifying the data to be shown, and then narrow it down by meta_type (ZClasses work well here). If I don't index it's a dog. If I dont't narrow it down by "Calendar" relevant meta_types but still index it, it's less of a dog, but not instant like I'll bet you're looking for. The a top snip of the code I ended up with is: <!--#var standard_html_header--> <center> <!--#with "_(recruiter_stuff=Catalog(recruiter=AUTHENTICATED_USER.getUserName(), meta_type=['Interview','Deal','Appointment','Call']))"--> <!--#calendar mode=month--> <a href="<!--#var "linkDate(date)"-->"> <!--#in recruiter_stuff--> <!--#if "calendar_date.dayOfYear()==date.dayOfYear()"--> <font color="FF0000"> <!--#/if--> <!--#/in--> <!--#var date fmt=dd--></a> </font> <!--#/with--> <!--#var standard_html_footer--> Good luck! -- Jason Spisak webmaster@hiretechs.com
At 14:39 10-9-99 , Jason Spisak wrote:
The a top snip of the code I ended up with is:
<!--#var standard_html_header--> <center> <!--#with "_(recruiter_stuff=Catalog(recruiter=AUTHENTICATED_USER.getUserName(), meta_type=['Interview','Deal','Appointment','Call']))"--> <!--#calendar mode=month--> <a href="<!--#var "linkDate(date)"-->"> <!--#in recruiter_stuff--> <!--#if "calendar_date.dayOfYear()==date.dayOfYear()"--> <font color="FF0000"> <!--#/if--> <!--#/in--> <!--#var date fmt=dd--></a> </font> <!--#/with--> <!--#var standard_html_footer-->
So you ask the Catalog for all items for a given user and then loop through all these items for every day displayed by the calender? Why not, depending on what would be speediest: 1. Call the Catalog for every day displayed and ask the it for items on that day. or 2. Call the Catalog once the first time the code in the calender tag is rendered (test for day one?), ask for the data for the current month, and store it in a REQUEST variable. Then loop through this limited set. In the last case, you could even make a temporary dictionary keyed on day of the month. This is quite simple. You should try and find a balance between number of loops and number of calls to the Catalog. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | T: +31 35 7502100 F: +31 35 7502111 | mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ---------------------------------------------
Martijin, I was having a lot of trouble comparing dates in the Catalog call. So I used this way. I also wrote this code with 0.1.0 of ZCatalog. I'd love to be able to ask the Catalog for just a months worth of data and then iterate through it for each month displayed. But it didn't work. Probably does now though. All my best, Jason Spisak
So you ask the Catalog for all items for a given user and then loop through all these items for every day displayed by the calender?
Why not, depending on what would be speediest:
1. Call the Catalog for every day displayed and ask the it for items on that day. or 2. Call the Catalog once the first time the code in the calender tag is rendered (test for day one?), ask for the data for the current month, and store it in a REQUEST variable. Then loop through this limited set.
In the last case, you could even make a temporary dictionary keyed on day of the month. This is quite simple.
You should try and find a balance between number of loops and number of calls to the Catalog.
-- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | T: +31 35 7502100 F: +31 35 7502111 | mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ---------------------------------------------
participants (3)
-
Jason Spisak -
Jason Spisak -
Martijn Pieters