[Seaside] How to ensure a script appears only once on page?

James Foster Smalltalk at JGFoster.net
Wed Mar 19 04:59:39 UTC 2008


I'm looking at some of the YUI components, specifically the calendar  
widget, and am struggling with how to create a script. As I understand  
the YUI library, I am supposed to create a Javascript that references  
each of the calendar widgets on my page. The script has the general  
format of (begin, middle, end), where the middle has a variable amount  
of code but the begin and end are fixed. My problem is that I might  
have calendar widgets on various components, and the components should  
not each add the script, because then there would be multiple begins  
and ends.

Now, there might be a work-around for the YUI calendar situation, but  
I have a more general question: Is there some way to hook in to the  
beginning or end of a render process? I've come up with a crude  
approach where each component notifies the session at the beginning  
and end of a render and the session keeps track of the first in and  
then lets it know when it is the last out. Are there any other good  
ideas?

James


More information about the seaside mailing list