htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0:
Difficulties with htmlArea v.2.03 in self-made CMS


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


TB
Novice

Dec 28, 2004, 12:24 PM

Post #1 of 12 (2862 views)
Shortcut
Difficulties with htmlArea v.2.03 in self-made CMS Can't Post

Hi all,

I've just implemented htmlArea 2.03 in a self-made (by a friend) PHP/MySQL Content Management System and I experience a couple of problems with it. Without htmlArea in it, the CMS works perfectly...all data (HTML code with some javascript code for "encrypting" the e-mail addresses) is stored in the MySQL (FreeBSD platform) without any problems. Collecting the data from the db to be able to edit the code, is working fine too. Even the javascript code is working because it is plain text.

Because this plain HTML text isn't convenient for a "simple" CMS user, I added htmlArea so the user is able to edit the pages at a easy manner. Though htmlArea is working properly in general, I experience some problems with it:
  • With htmlArea implemented, the javascript code used for the "encryption" of e-mail addresses in HTML pages is executed everytime I save the code in the db. Due to this, the e-mail address is displayed more then 1 time (depending on the times you clicked "save" :)) and NOT encrypted anymore!
    Is there a way to get around this javascript code, still using the WYSIWYG mode of htmlArea?
  • With htmlArea implemented, it seems impossible to store huge HTML pages in the database?! For example: I copied the HTML code of a 50kb large webpage out of Dreamweaver and pasted it into the textfield which lay-out is defined by htmlArea. Without htmlArea, no problems occur when storing or reading the data into or out of the database into the textfield, but when using htmlArea, I'm not able anymore to read the data out of the database! The browser (IE6 on XP) says the page can't be opened and the operation is cancelled.
    With smaller pages (HTML code of a couple of bytes), there's no problem at all! As said, without htmlArea everything is working fine, so I guess it has to do with htmlArea.


I can imagine that it is hard to understand what I'm trying to explain, but I hope some of you have an idea on how to solve this or what I need to look at. If more information is needed, please tell me.

TIA for any help/suggestion!


TB
Novice

Dec 29, 2004, 9:38 AM

Post #2 of 12 (2828 views)
Shortcut
Re: [TB] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

No one who can help?


Luis
Veteran

Dec 29, 2004, 11:52 AM

Post #3 of 12 (2823 views)
Shortcut
Re: [TB] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

Hi TB:

For the second issue, make sure your form uses POST method instead of GET.

For the first one, it would help better if there is a chance to see the actual code to try to find out a different method for the encryption. The problem with javascript inside the htmlarea is that the javascript code is executed everytime the hidden field updates contents, meaning every time the form is submitted or everytime you switch modes (WYSIWYG and HTML code).

Greetings


Don't give up!!
http://webstationone.com/test/htmlarea


TB
Novice

Dec 29, 2004, 12:44 PM

Post #4 of 12 (2817 views)
Shortcut
Re: [Luis] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

Hi Luis, thank you for your reaction!

Second issue:
The form uses the POST method, so that isn't the problem I guess.
I just discovered that I get the same errors sometimes when I try to open even the small pages! This only occurs while I'm using my full bandwidth for uploading. Maybe it is something like a time out? Is this possible? In that case, Internet Explorer should wait more that one millisecond (the error message appears immediately after selecting the page). I don't know if this is the problem, but it is remarkable that I get the same error with the small pages when using all bandwidth available. The problem with the large pages even occurs when not uploading.


First one:
That's exactly the problem. Everytime I save the content or switch between HTML and WYSIWYG mode, the (not encrypted) e-mail address is copied. This is an example of the "encryption" code for test@test.com (using: http://www.dynamicdrive.com/emailriddler/index.htm):

<script type="text/javascript">
/***********************************************
* Encrypt Email script- Please keep notice intact.
* Tool URL: http://www.dynamicdrive.com/emailriddler/
* **********************************************/
var emailarray0099= new Array(116,101,115,116,64,116,101,115,116,46,99,111,109)
var postemail0099=''
for (i=0;i<emailarray0099.length;i++)
postemail0099+=String.fromCharCode(emailarray0099)
document.write('<a href="mailto:'+postemail0099+'">mail me</a>')
</script>


TIA for any help...


Luis
Veteran

Dec 29, 2004, 1:58 PM

Post #5 of 12 (2804 views)
Shortcut
Re: [TB] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

Hi TB:

Can you post the html code for your textarea page? I need to see it as after it's executed by your CMS script. You can copy the code from the browser.

Is your editor_generate script inside the <form> tags, if so, try moving it after the closing </form>. Even when it's possible, I don't think it's a server time out issue, unless your server is dramatically limited in resources, even more if you say it happens although you don't submit the form.

As per the email encryption, the email ridder you are using wont work because it uses document.write. I'll try a different way to encrypt them in real-time, using
either escape(string) or string.replace() methods. I'll let you know.


Don't give up!!
http://webstationone.com/test/htmlarea


TB
Novice

Dec 29, 2004, 3:27 PM

Post #6 of 12 (2795 views)
Shortcut
Re: [Luis] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

Hi Luis,

I can't believe it...it seems this simple hint did the trick! The editor_generate javascript code was in front of the <form> tag, not even inside it! I just moved it after the closing </form> tag and everything seems to work :) Is this normal (read: was it a silly mistake I made?) ? I will test the functionality the next few days and report if the problem stays away.

I'm curious about your alternative to encrypt the e-mail addresses. I think it can be useful not only for me.

Thanks for your help!

Regards,

TB


Luis
Veteran

Dec 29, 2004, 5:26 PM

Post #7 of 12 (2790 views)
Shortcut
Re: [TB] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

Hi TB:

It's an error in the order of execution of the page's code. Let me try to explain it a little bit:

One of the first things that editor.js does is to check up if the textarea has contents. If you put the editor_generate script above the form tags, it starts executing at the same time the form elements are rendered. If the textarea contents are too long, editor_generate will finish executing before the textarea contents are fully rendered and will only display what it was able to read at the time the part of the code that reads the textarea's contents was executing or, in some cases will display nothing.

Moving the script after the form, the script will start executing only until after the browser reads the </form> tag. It's not a silly mistake but it's frequent in HTMLArea implementation.

As per the email address encoding, I'm attaching a file with instructions on how to implement the mod.

Greetings


Don't give up!!
http://webstationone.com/test/htmlarea
Attachments: encode_email.txt (2.28 KB)


TB
Novice

Dec 30, 2004, 5:50 AM

Post #8 of 12 (2762 views)
Shortcut
Re: [Luis] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

Hi Luis,


Quote
It's an error in the order of execution of the page's code. Let me try to explain it a little bit:

One of the first things that editor.js does is to check up if the textarea has contents. If you put the editor_generate script above the form tags, it starts executing at the same time the form elements are rendered. If the textarea contents are too long, editor_generate will finish executing before the textarea contents are fully rendered and will only display what it was able to read at the time the part of the code that reads the textarea's contents was executing or, in some cases will display nothing.

Moving the script after the form, the script will start executing only until after the browser reads the </form> tag. It's not a silly mistake but it's frequent in HTMLArea implementation.



Thanks for the explanation. It's clear to me now. I'm glad there are some java guru's around here :) (I do understand PHP a little bit, but Java/JavaScript absolutely not).


Quote
As per the email address encoding, I'm attaching a file with instructions on how to implement the mod.



Wow, great! Works beautifully! One comment though: is it possible to display the typed/pasted e-mail address instead of the "send us an email" message (I know that's an example) for every e-mail address? I can change the message in "info@mydomain.com", but when I type another address (say webmaster@mydomain.com), this info@ text is displayed.

Regards,

TB


Luis
Veteran

Dec 30, 2004, 1:20 PM

Post #9 of 12 (2740 views)
Shortcut
Re: [TB] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

Hi TB:

Having the real emai address displayed doesn't make sense. Why to encode the mailto: part if spammer's robots will still be able to read the other part?

If you still want to do it, replace this line:
if(inner.indexOf("@")>=0){edit_Link.innerHTML = "send us an email";}
with:
if(inner.indexOf("@")>=0){edit_Link.innerHTML = address;}//will display the real e-mail address

Or try these other suggestions replacing the same line with:
inner = inner.replace(/@/g
, '-at-');
if(inner.indexOf("-at-")>=0){edit_Link.innerHTML = inner;}//displays somebody-at-somewhere.xxx


******************

if(inner.indexOf("@")>=0){edit_Link.innerHTML = "Send an email to
"+inner.substring(0,inner.lastIndexOf("@"));}//will display Send an email to username eg: if email is info@mydomain.com Send an email to info. (put this in a sigle line, nowrapping)

Anyway, any option you decide to use, you will still be able to edit the displayed text manually.

Greetings.



Don't give up!!
http://webstationone.com/test/htmlarea


(This post was edited by Luis on Dec 30, 2004, 1:22 PM)


TB
Novice

Dec 30, 2004, 2:23 PM

Post #10 of 12 (2731 views)
Shortcut
Re: [Luis] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

Hi Luis,

You're right, with the address as plain text, a spambot is able to read the e-mail address. But, with the e-mail riddler I used, it is possible to display the encoded e-mail address instead of "send us an email" or something like that. My previous example wasn't practical, here's another one:

<script type="text/javascript">

/***********************************************
* Encrypt Email script- Please keep notice intact.
* Tool URL: http://www.dynamicdrive.com/emailriddler/
* **********************************************/


var emailarray2120= new Array(105,110,102,111,64,109,121,100,111,109,97,105,110,46,99,111,109)
var postemail2120=''
for (i=0;i<emailarray2120.length;i++)
postemail2120+=String.fromCharCode(emailarray2120)


document.write('<a href="mailto:'+postemail2120+'">'+postemail2120+'</a>')

</script>

The e-mail address encoded here, is info@mydomain.com. As you can see, the displayed text is '+postemail2120+' which is info@mydomain.com. In the source code, you can't find any @ or -at- "text" so spambots will be unable to find your e-mail address this way.

This is what I would like to use....your options are ok, but I just want to display an e-mail address instead of some words like "send us an email".

Is this possible with your encryption alternative?

Regards,

TB


Luis
Veteran

Dec 30, 2004, 3:58 PM

Post #11 of 12 (2727 views)
Shortcut
Re: [TB] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

Hi TB:

Unfortunately any <script> code inside the editor will be executed. You cannot have the email address in the form of a variable because the editor will transform it into it's real value.

Your emailriddler alternative is pretty clever but unfortunately it doesn't work for HTMLarea. Sometimes we need to decide between what we would like and what really works.

I'll try to find another solution for you but I don't guarantee to succeed.

Greetings


Don't give up!!
http://webstationone.com/test/htmlarea


(This post was edited by Luis on Dec 30, 2004, 3:59 PM)


TB
Novice

Jan 1, 2005, 1:51 PM

Post #12 of 12 (2700 views)
Shortcut
Re: [Luis] Difficulties with htmlArea v.2.03 in self-made CMS [In reply to] Can't Post

First of all: A happy and healthy new year to everyone!

Hi Luis,


Quote
Sometimes we need to decide between what we would like and what really works.



That's true. Although I think it's a pitty that it can't work together, I can live with your alternative :) So...if you can find another solution, I would be glad to give it a try but if not, I will use it this way.

Thanks again for your help!

Greetz,

TB

 
 
 


Search for (options)