Forum OpenACS Q&A: Response to TCL Q--> How do Include a file?

Collapse
Posted by Michael A. Cleverly on
When you say that your Tcl proc "barfs on the javascript because the tcl interpreter thinks it is parsing tcl" it sounds like you've got a chunk of javascript like this:
proc my_header_text {} {
    return " ... java script stuff ... "
}
In which case any $ or braces are going to be interpreted by Tcl. What you want instead is to wrap your chunk of javascript in curl braces like:
proc my_header_text {} {
    return { ... javascript stuff here ... }
}
Curly-braces defer execution in Tcl. If you need to dynamically generate javascript code from Tcl (based on Tcl variables, details about the connection, etc.) then you need to escape all the $ and braces with backslashes.