Config options and JS

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Config options and JS

Post by cmb » Fri Jul 08, 2011 5:50 pm

Hello JS developers,

in the Pagemanager thread I came across an interesting phenomenon regarding $plugin_cf and $plugin_tx in JS scripts.

A user had entered a "\n" into a config option. The config option was sent unmodified to a JS script. The JS interpreter failed with 'unterminated string literal', because JS (opposed to PHP) doesn't allow linebreaks in string literals!

IMHO every developer should replace newlines in $plugin_cf and $plugin_tx before using them in JS scripts.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply