encode_js

Encodes any special characters so that the string can be used safely as the value in Javascript.

Example:

    <script type="text/javascript">
<!-- /* <![CDATA[ */
var the_title = '<$MTEntryTitle encode_js="1"$>';
/* ]]> */ -->

Depending upon your needs encode_html="1" might be a better solution in some javascript code.

Related modifiers:

This page was last updated on 2009-04-29, 10:44.

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.