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

Ramon Leon ramon.leon at allresnet.com
Wed Mar 19 16:20:59 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

I use YUI calendar, but I'm really not following what you're trying to say,
can you be a little more explicit?  If you have multiple calendars on the
page, other than the generic includes of the calendar.js, why would the
calendars share any setup script?

Ramon Leon
http://onsmalltalk.com



More information about the seaside mailing list