Page 1 of 1

FCKeditor stripping out/changing ampersand entity

Posted: Thu Apr 19, 2007 12:49 pm
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. ???

Re: FCKeditor stripping out/changing ampersand entity

Posted: Fri May 11, 2007 9:56 pm
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!  :(

Re: FCKeditor stripping out/changing ampersand entity

Posted: Fri May 11, 2007 10:10 pm
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.

Re: FCKeditor stripping out/changing ampersand entity

Posted: Wed May 16, 2007 2:58 pm
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.  :-\

Re: FCKeditor stripping out/changing ampersand entity

Posted: Thu May 24, 2007 11:34 am
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…

Re: FCKeditor stripping out/changing ampersand entity

Posted: Mon Nov 19, 2007 9:16 pm
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?

Re: FCKeditor stripping out/changing ampersand entity

Posted: Mon Jun 02, 2008 1:36 pm
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!...

Re: FCKeditor stripping out/changing ampersand entity

Posted: Mon Jun 02, 2008 7:12 pm
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...

Re: FCKeditor stripping out/changing ampersand entity

Posted: Tue Jun 03, 2008 8:35 am
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.