FCKeditor stripping out/changing ampersand entity

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
10010110

FCKeditor stripping out/changing ampersand entity

Post by 10010110 »

Now this is something weird: I have a page with URLs with parameters, e.g.:

Code: Select all

dl_st.php?vid=3&var=1176983883.96
I put this URL directly in the source code through HTML editing mode in FCKeditor, and encoded the ampersand with the appropriate entity (&). Also this URL is enclosed as string in a JavaScript function that is called on click to open a popup window:

Code: Select all

<a onclick="dl('dl_st.php?vid=1&var=1176983883.96'); return false;" href="dl_st.php?vid=1&var=1176983883.96">
Now what happens is whenever somebody opens that page to edit something on it the ampersand in the entity is stripped out/replaced with a single quote ('amp;) which is ending the JavaScript string, and thus rendering the function invalid as the rest of the URL isn’t recognized as part of this string anymore. How can I avoid that?

It’s not doing that with regular URLs in the href (not in a JS function), and putting {literal} tags doesn’t work either. ???
10010110

Re: FCKeditor stripping out/changing ampersand entity

Post by 10010110 »

Hey, I just noticed this is not only happening to ampersands in entities but to ampersands generally. Is this a common/known bug of the CMS? That’s not good at all because I have some google shopping cart tracking code that relies on JavaScript and doesn’t work anymore. Please help!  :(
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: FCKeditor stripping out/changing ampersand entity

Post by calguy1000 »

disable the wysiwyg and things should work.
for blobs of html code that you want to include in your page, you may want to use gcb's though.  that's what they're designed for.  And the wysywig won't get in their way.

As a general rule, wysiwygs are evil.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
10010110

Re: FCKeditor stripping out/changing ampersand entity

Post by 10010110 »

Uhm… yeah thanks for that tip. I didn’t know that before.  ::)

#1: If I had the choice I would write my cody by hand anyway.
#2: The problem is that I’m not the only one that is editing the pages and there are editors that have no idea of HTML and I can’t tell everybody to not use any WYSIWYG editor because actually that’s why I’m running the CMS, because it makes it easy for other people to edit content without editing the HTML.
#3: Global content blocks are not an option as they can be edited with the same crappy WYSIWYG editor and they are just not practical in this case.

Any more helpful answers? Please, this is a serious problem.  :-\
10010110

Re: FCKeditor stripping out/changing ampersand entity

Post by 10010110 »

Well, I had a different approach to it now that I will share in case someone else has this problem.
It’s very simple:
  • Create new user defined tag (I named it “amp” like the HTML entity)
  • put this PHP in there: echo "&";
  • in the HTML view in your editor wherever this occurs put {amp}
But still, this is something someone savvy should look into…
User avatar
deejmer
Forum Members
Forum Members
Posts: 69
Joined: Thu Jan 11, 2007 7:32 pm

Re: FCKeditor stripping out/changing ampersand entity

Post by deejmer »

OK....so I'm using TinyMCE, and just like the problem here, my entities are being changed when saved.  The solution of turning off WYSIWYG altogether is not an option for me as my users need this functionality.  And you can enter a page or content block and turn it off and paste in the code, thats all fine and well.  BUT when you go back in, the WYSIWYG is turned back on.  Is there some setting or hack that we can have each page, content block, news item, etc REMEMBER what you had chosen in respect to the WYSIWYG editor the last time visited?  This in my mind could alleviate the problem.

Ideas?  Is this possible?
saltydog
Power Poster
Power Poster
Posts: 281
Joined: Fri Mar 04, 2005 9:06 am

Re: FCKeditor stripping out/changing ampersand entity

Post by saltydog »

I am struggling too with this issue and I really believe that a good class CMS should take care of this. I cannot switch WYSIWYG off, as my content editors need it, but it changes all my entities in my tags!...
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: FCKeditor stripping out/changing ampersand entity

Post by Dr.CSS »

You should have started a new thread as this is old, and I bet you are using the default which is tiny, it has a tick box in the module interface Extensions > TinyBasic  it's a check box so you can toggle it between wysiwyg to html...

If you toggle it out of wysiwyg then add your code and submit the page w/o going back to wysiwyg mode then your code will be saved as is, but the next time you open the page to edit it will mess with your code...
saltydog
Power Poster
Power Poster
Posts: 281
Joined: Fri Mar 04, 2005 9:06 am

Re: FCKeditor stripping out/changing ampersand entity

Post by saltydog »

mark wrote:
If you toggle it out of wysiwyg then add your code and submit the page w/o going back to wysiwyg mode then your code will be saved as is, but the next time you open the page to edit it will mess with your code...

Mark,
Sorry for not having opened a new thread. It was my fault.
I am using FCKEditor 1.1.0, and the trick you suggested does the job, of course, but it is not manageable in a community of 10 editors. Each time the page is re-opened with the WYSIWY, it messes up everyhting.
Locked

Return to “CMSMS Core”