WebmasterSite.net

Javascript in Database Fields Error
Problem using JS in a custom added database field.

Version: 4.1.79
URL: http://couponfetch.com/index.php?action=displaycat&catid=2276

PrintPrint


Javascript in Database Fields Error
eeyipes
Experienced

Usergroup: Customer
Joined: Nov 12, 2004

Total Topics: 34
Total Posts: 60
quote post #1
Posted 11/16/09 - 4:05 PM:

I would like to add ad widgets to category pages, with a different widget per page. I added a text field to "categories" in the database via the admin panel. The idea is to add the widgets as part of the category setup/edit and display them just for that category.

Many ad widgets utilize javascript, and I am having a problem with how they render on the page when {CATWIDGET} is called on. Specifically, it is the " ' " apostrophy symbol that isn't reading right. For example, a line of the JS script reads something like

adunit = '123456';

but when it prints to the page when {CATWIDGET} is called upon, the source code reads

adunit = '123456'

and errors are being caused.

So it seems the apostropies are not reading to the page correcty when {CATWIDGET} is called upon. However, when I edit the category and view the JS in the textarea box, it looks fine.

Any ideas?

Edited by eeyipes on 11/16/09 - 4:08 PM
Paul
developer
Avatar

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 65
Total Posts: 7614
quote post #2
Posted 11/20/09 - 4:43 AM:

It needs to be stored in the database with & # 3 9 ; in place of '. I'll look into translating it back to ' at display time for 5.1.13 -- at least on certain pages. It might be used inside ' quoted html tags on the submit/edit page so it should be kept html encoded there.

Update: done in 5.1.13.

Edited by Paul on 11/20/09 - 5:10 AM
 
Search thread for
Download thread as


Sorry, you don't have permission to post. Log in, or register if you haven't yet.