Adding Spry includes in a Model Glue template

As the Spry(and any Ajax framework) files aren't the smallest set of files to add to your page you don't want the user to download them if they don't need to. The way I add the Spry files to a display template in Model Glue is per event via a variable defined in the XML controller. For this example I'm going to include the SpryCollapsiblePanel.js file.

Posted: 15-Aug-2007

View: 4075

Permalink: here

Comments

This is the same way I do it - except I use the viewState in the view. So I normaly have this in my view:

<cfset viewState.setValue("title", "Page title")>

Then my template view picks it up. So right next to I just add:

<cfset viewState.setValue("needSpry", true)>

Any particular reason why you felt the need to do it in the XML instead of the view?

#1 Raymond Camden
15/Aug/07 4:15 AM

@Ray I thinks Its just the way I work. I try to preset everything the view needs in the xml before getting into the view like eXit Events etc.

#2 Andy Jarrett
15/Aug/07 5:17 AM

If you're going to do it in the ModelGlue.xml, you could also do it as a separate include.
<inc1ude name="javascript" template="spryincludes.cfm" />
You would then simply have a spot to plug in "javascript" in your template just like you have a spot for "body".

#3 Luis Matthews
15/Aug/07 6:18 AM