CodeIgniter Forums
TinyMCE and Email Addresses - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: TinyMCE and Email Addresses (/showthread.php?tid=5232)



TinyMCE and Email Addresses - El Forum - 01-12-2008

[eluser]charlie spider[/eluser]
Hi everyone,

Just uploading my first CI site that I built in the evenings and on weekends (ie: I'm no pro) and can't figure this bug out.

The site has a CMS backend for it that uses the TinyMCE editor for the main text blocks on each page of the site. I can write some content into the editor, save it to the database and display it on the main site no problem.

However...

If the content contains an email address, TinyMCE wants to convert it to something like this:

//<![CDATA[
var l=new Array();
l[0]='>';l[1]='a';l[2]='/';l[3]='<';l[4]='|97';l[5]='|99';l[6]='|46';l[7]='|119';l[8]='|97';l[9]='|104';l[10]='|115';l[11]='|64';l[12]='|114';l[13]='|101';l[14]='|100';l[15]='|110';l[16]='|101';l[17]='|112';l[18]='|110';l[19]='|111';l[20]='|101';l[21]='|115';l[22]='|117';l[23]='|111';l[24]='|104';l[25]='>';l[26]='"';l[27]='|97';l[28]='|99';l[29]='|46';l[30]='|119';l[31]='|97';l[32]='|104';l[33]='|115';l[34]='|64';l[35]='|114';l[36]='|101';l[37]='|100';l[38]='|110';l[39]='|101';l[40]='|112';l[41]='|110';l[42]='|111';l[43]='|101';l[44]='|115';l[45]='|117';l[46]='|111';l[47]='|104';l[48]=':';l[49]='o';l[50]='t';l[51]='l';l[52]='i';l[53]='a';l[54]='m';l[55]='"';l[56]='=';l[57]='f';l[58]='e';l[59]='r';l[60]='h';l[61]=' ';l[62]='a';l[63]='<';
for (var i = l.length-1; i >= 0; i=i-1){
if (l[i].substring(0, 1) == '|') [removed]("&#"+unescape(l[i].substring(1))+";");
else [removed](unescape(l[i]));}
//]]>

which gets converted back to regular text when the page is viewed in the browser, but remains as above in the source code so that presumably spam-bots won't be able to read the email address.

That's fine.

The problem is if I edit or resave a page that has one of these javascript converted email addresses in it, it no longer reconverts the email address to regular text in the browser, and the webpage viewer sees the same goobly-gook as shown above.

The site is already a little late being launched so any help pointing me in the right direction would be super greatly appreciated.

Thanks


TinyMCE and Email Addresses - El Forum - 01-12-2008

[eluser]tonanbarbarian[/eluser]
this may or may not be the problem but with tinymce you should always be very careful about the paths you use to include it etc.
in particular if the domain information is even slightly different between the page and the script it will have problems

i.e. you site is being browsed from http://www.someplace.com/
but in the view you include the tinymce from http://someplace.com/
This can and will cause TinyMCE (and other editors) to not act as expected because the browser things that the javascript is being loaded from an external site and limits what can be done for security reasons.
This can result in popups displaying blank pages, formatting not working correctly and a multitude of other issues.
If I ever have issues with a WYSIWYG editor not working on the webpage my first thing I check is the paths.

Hope this points you in the right direction


TinyMCE and Email Addresses - El Forum - 01-13-2008

[eluser]charlie spider[/eluser]
Thanks for the response.

I actually use a CI helper that loads my css, images and javascript for me, so my paths are never an issue as they are always relative to the base url. It works great and can be found here:

http://ellislab.com/forums/viewthread/45055/


TinyMCE and Email Addresses - El Forum - 01-16-2008

[eluser]charlie spider[/eluser]
Solved it.

I was using auto_link on the content that was being pulled from the database and then fed into the TinyMCE editor. Apparently TinyMCE don't play well with auto_link.