Adding script to DWT in Expression Web

A question came up recently on the RootsWeb Expression Web Mailing List:

“I am using a Dynamic Drive Lightbox image viewer script on only a couple pages of my site. The script must be placed within the HEAD section. Is there any reason not to put this in the DWT? Or should it just be put on the pages involved? Which could lead to problems if you make changes to the DWT later and forget that you have added to the HEAD section of those pages. Or should I have a separate DWT for those pages?”

A simple solution is to add a scripting area as an editable region on your Dynamic Web Template (DWT).

Insert this code in the head section of your DWT:

<!– #BeginEditable “scripting” –>
<!– Scripting area here –>
<!– #EndEditable –>
When you need to add a script to your page or pages, insert it in place of  <!– Scripting area here –>. Simple solution.

Because it is located in an editable region, the script on the page will not be changed when you update your DWT.

Speak Your Mind

*