passing CF value to a javascript

0 views
Skip to first unread message

jarthel

unread,
Nov 7, 2009, 6:07:42 AM11/7/09
to Mach-II for CFML
I have a .js file which I load using AddJavascript mach-ii function.
The problem I have found is that there is no way to control where the
script line will be added in the head section.

so how did you overcome this (still using AddJavascript function AND
having all js code in the js file)?

Thank you

Peter J. Farrell

unread,
Nov 7, 2009, 1:15:44 PM11/7/09
to mach-ii-for...@googlegroups.com
We can't control where in the head it is appended. We use cfhtmlhead tag in the background which appends items right before the closing head tag in the order they are put in via cfhtmlhead. Sounds like you have dependent js files (like needing prototype.js and effects.js before other files). Look into asset packages - a group of assets to be appended. The helper keeps track of files already appended so if you have two asset packages that both depend on a few common assets, the helper won't append duplicates.

Also you might be using addJavascript in a view (which by defaults to appended to head) and later on using addJavascript inside your layout view which has the head section. Look into using the outputType="inline" for the addJavascript calls that are inside your head section.

.Pjf
Reply all
Reply to author
Forward
0 new messages