You are here: Administrators Reference > Site Administration > Static Content Generation > Miscellaneous > Embedding Other Script Modules > Using the Custom Script Element


Using the Custom Script Element

The Custom Script Element allows you to embed alternative script elements into your CommonSpot page. In author and read mode on the Authoring Server, the code is ignored. When the static page is generated, the appropriate ‘include’ code is placed in the file so that the web server serving the static page executes the code properly. For example, if you want your static content page to include an ASP file, you would enter something like “/myASP/foo.asp” into the “Explicit Module” path. You can also pass parameters from CommonSpot to your custom script module by clicking the “Parameters” tab in this dialog and entering name-value pairs “foo=1” (separated by line feed). CommonSpot will automatically convert those values into variables the script can interpret.

When the static file is generated CommonSpot will call /commonspot/scripthandlers/handler_asp.cfm to produce the proper include code for ASP , i.e.: “<!--#include virtual="/myASP/foo.asp"-->”. CommonSpot is installed with three script handlers for placing ASP, PHP and PERL includes into a CommonSpot page.

While there is no actual API for the handlers, you can write your own using the examples given. The module should include “/commonspot/controls/customcf/handlerGetParams.cfm" to pass parameters from CommonSpot (ColdFusion) into your specified language. If you write your own module for a language other than those shipped with CommonSpot (JSP for instance), be sure to save the file in your “Sites” /scripthandlers/ directory, not CommonSpot. The naming convention for the file should be: “handler_#ext#.cfm” so that a script handler supporting a JSP include would have the name “handler_jsp.cfm”.


Note: When creating/modifying script handlers, be sure to:

(a) move a copy of the file from the /commonspot/scripthandlers directory to your site’s /scripthandlers directory, and

(b) use “&cspound;” instead of “#” if you want CommonSpot to evaluate a variable. This code is sent to the element-level cache, and this replacement is required in order for this to be executed.


Related Links

You can download PDF versions of the Content Contributor's, Administrator's, and Elements Reference documents from the support section of (requires login).

For technical support: