htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 3 (beta): htmlArea 2 & 3 archive (read only): htmlArea v3.0 - Discussion:
PHP based Spell Checker


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.

 


webmonkey
Novice

Mar 9, 2004, 4:05 PM

Post #1 of 21 (7662 views)
Shortcut
PHP based Spell Checker Can't Post

I have used pspell and a php script to replace the cgi that Mishoo has provided. I will post the code in the next post.

You can replace the cgi file with the php file, and make the form on the spell-check-ui.html submit to the php file.

It seems to work well, but I am having one problem. Maybe someone here can help... When I go back in and put the span tags around the words that are incorrect, I end up putting the tags around all of the instances including the instances contained in html tags. I see that in perl, mishoo used xml functions to recognise the elements. Does anyone have any suggestions for my PHP version?


webmonkey
Novice

Mar 9, 2004, 4:06 PM

Post #2 of 21 (7652 views)
Shortcut
Re: [webmonkey] PHP based Spell Checker [In reply to] Can't Post

Here is the file:

Code
<? 
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="all" href="spell-check-style.css" />
<script type="text/javascript">';
echo 'var suggested_words = { ';

$words = split("[^[:alpha:]']+", strip_tags($content));
$pspell_link = pspell_new("en_CA");
$misspelled=array();
for($i=0;$i<sizeof($words);$i++)
{

if (!pspell_check($pspell_link, $words[$i]))
{
if(!in_array($words[$i],$misspelled))
{
if(sizeof($misspelled)!=0){echo ',';}
echo '"'.$words[$i].'":"'
.implode(',',pspell_suggest($pspell_link, $words[$i])).'"';
$content=str_replace($words[$i], '<span class="HA-spellcheck-error">'.$words[$i].'</span>', $content);
$misspelled[]=$words[$i];
}
}
}


echo '};'
.'var spellcheck_info ='
.'{ "Total words":"'.sizeof($words).'","Mispelled words":"'.sizeof($misspelled).' in dictionary \"en_CA\"","Total suggestions":"-","Total words suggested":"-","Spell-checked in":"--" }; </script>'
.'</head>
<body onload="window.parent.finishedSpellChecking();">
'.stripslashes($content).'
</body></html>';

?>


I did the whole thing inline to try and cut down on code size.

Oh yea and looking at it there are still some things that are not ready for release... But since I need some help :)


(This post was edited by webmonkey on Mar 9, 2004, 4:09 PM)


nikotto
User

Mar 10, 2004, 12:54 AM

Post #3 of 21 (7642 views)
Shortcut
Re: [webmonkey] PHP based Spell Checker [In reply to] Can't Post

actually i have done the same thing :D
i took the php-script as a basis that i found here on this board...

one thing i didn't manage: read out all avaliable dictionaries!

mfg


webmonkey
Novice

Mar 10, 2004, 10:44 AM

Post #4 of 21 (7621 views)
Shortcut
Re: [nikotto] PHP based Spell Checker [In reply to] Can't Post

did you solve the problem that I am having?

Can I see your script?

Thanks

Dave


webmonkey
Novice

Mar 10, 2004, 12:55 PM

Post #5 of 21 (7615 views)
Shortcut
Re: [webmonkey] PHP based Spell Checker [In reply to] Can't Post

Meh... never mind... I have rebuilt the script to use the xml module. Seems to work great now.

If anyone is interested in my code I can post it... There are other examples around. Most use pear though. So if your not using pear... :)


kimss
User

Mar 10, 2004, 4:01 PM

Post #6 of 21 (7605 views)
Shortcut
Re: [webmonkey] PHP based Spell Checker [In reply to] Can't Post

Hei there, I would love to check out your PHP code for the spell checker. I have no problem using the CGI script, but I favour having all files in PHP since I dont do Perl anymore - though I have the opinion its superior regarding regexes and such.

You can email the spellchecker to kim@steinhaug.com and Ill check it out. Ill start doing some mods myself soon, just need to complete some of my business projects first.

Kim Steinhaug
www.steinhaug.com

Kim Steinhaug
kim-at-steinhaug-dot-com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Norwegian office : +47 88 00 92 45, Swedish office : +46 31 704 43 40
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


webmonkey
Novice

Mar 10, 2004, 4:13 PM

Post #7 of 21 (7603 views)
Shortcut
Re: [kimss] PHP based Spell Checker [In reply to] Can't Post

Not the prettiest thing in the world... but.....



Oh yea.. things that don't work... I do not provide any information about how many words were checked and so on... I decided not to spend cycles on any of that.

Also getting a language list in php is not really supported so I have hard coded in canadien english. If you want to change this it's not too hard, and updating it to support multiple languages is not too bad either.

hope it works well for ya.
Attachments: spell-check-logic.php (2.99 KB)


kimss
User

Mar 10, 2004, 4:39 PM

Post #8 of 21 (7599 views)
Shortcut
Re: [webmonkey] PHP based Spell Checker [In reply to] Can't Post

Thanks,

Ill be looking into and testing your file tomorrow. (Its 11:39 PM here). Ill keep you posted.

Kim Steinhaug

Kim Steinhaug
kim-at-steinhaug-dot-com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Norwegian office : +47 88 00 92 45, Swedish office : +46 31 704 43 40
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


kimss
User

Mar 10, 2004, 4:49 PM

Post #9 of 21 (7598 views)
Shortcut
Re: [kimss] PHP based Spell Checker [In reply to] Can't Post

Just did a quick test of the script, a question :

Am I missing some funnctions here?

class pspell_new{}
class pspell_check{}
class pspell_suggest{}

Regards,
Kim Steinhaug

Kim Steinhaug
kim-at-steinhaug-dot-com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Norwegian office : +47 88 00 92 45, Swedish office : +46 31 704 43 40
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


webmonkey
Novice

Mar 10, 2004, 4:55 PM

Post #10 of 21 (7598 views)
Shortcut
Re: [kimss] PHP based Spell Checker [In reply to] Can't Post

You have to have the pspell library for PHP installed.

You also need the xml library.

see the php.net website for how to do that.


kimss
User

Mar 10, 2004, 5:05 PM

Post #11 of 21 (7597 views)
Shortcut
Re: [webmonkey] PHP based Spell Checker [In reply to] Can't Post

Alrighty! Wink My bad!

Looks like this would be something to do in the morning, since I havnt installed this on either in my development environment, or on the production server.. Doh! To top it off Its also Win2000 and Linux so I need to do it for both.

Ill get back to you when this is done and Ive tested the script, thanks for tipping my tired brain in the rigth direction, :)

Kim Steinhaug

Kim Steinhaug
kim-at-steinhaug-dot-com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Norwegian office : +47 88 00 92 45, Swedish office : +46 31 704 43 40
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


kimss
User

Mar 11, 2004, 4:39 AM

Post #12 of 21 (7567 views)
Shortcut
Re: [kimss] PHP based Spell Checker [In reply to] Can't Post

CrazyLooks like im stuck herer. My development machine runs on a Windows2000 system with Apache, and the PSPELL just wont work on this system. After trying to solve this for 3,5 hours now I finally give up and need to start working...

I experimented with the command line version aswell, without any luck - wouldnt work and it also introduced some fresh Javascript errors.

To keep it short, this probably works fine on a *nix platform, but aslong as it doesnt work on the Windows system Im not able to actively work with the code. Maby next release of the Windows binaries for PHP adresses theese problems. The problem by the way is that PSPELL can read the dictionaries. Whan manually launching Aspell from the command line it all works swell. Anyway, the annoying PHP error that just wont go away is :

Warning: PSPELL couldn't open the dictionary. reason: No word lists can be found for the language "en".

So, Ill have to put the spellecheker on ice for some more time, to bad. Its not easy all the time with all theese dependencies, hehe.

UPDATE!
--------
As a programmer I just can rest when a problem is open. So I finally got a spellcheck to work, this gives me something to work on - though it has nothing to do with the spellchecker currently available in HTMLAREA, I found this one :
http://spellerpages.sourceforge.net/

This I succesfully tested on my Windows2000, it uses command line access to Aspell and works like a charm, meaning I have something to work on here. So for you other people on Windows that couldnt get the PSPELL to work, look at this one.

Regards,
Kim Steinhaug
www.steinhaug.com

Kim Steinhaug
kim-at-steinhaug-dot-com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Norwegian office : +47 88 00 92 45, Swedish office : +46 31 704 43 40
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


(This post was edited by kimss on Mar 11, 2004, 5:24 AM)


chakal
Novice

Mar 12, 2004, 2:04 PM

Post #13 of 21 (7533 views)
Shortcut
Re: [kimss] PHP based Spell Checker [In reply to] Can't Post

Hi,

I try to configure spellerpages with HTMLArea but 'undefined' appears in spellerpages popup.
How did you do that ?

chaKal


pvollma
Novice

Mar 12, 2004, 3:15 PM

Post #14 of 21 (7528 views)
Shortcut
Re: [kimss] PHP based Spell Checker [In reply to] Can't Post

I can get spellerpages to popup from the spellcheck icon on htmlarea, and I can load the current htmlarea text into it, and spellcheck it. However, I can't figure out how to get the spellchecked and updated textarea in spellerpages to replace the original htmlarea. Can you help?
Paul C. Vollmar


kimss
User

Mar 12, 2004, 3:23 PM

Post #15 of 21 (7527 views)
Shortcut
Re: [pvollma] PHP based Spell Checker [In reply to] Can't Post

Just a little update here, Ill look into this sometime tomorrow (saturday) and give you an update on my findings..

Kim Steinhaug
kim-at-steinhaug-dot-com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Norwegian office : +47 88 00 92 45, Swedish office : +46 31 704 43 40
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


rehab_shouman
Novice

Mar 18, 2004, 4:23 AM

Post #16 of 21 (7432 views)
Shortcut
Re: [kimss] PHP based Spell Checker [In reply to] Can't Post

u came up with an exxcelent solution, but i tried using the spellerpages....but befor i start doing anything, it gives me javascript error that i couldn't solve..and then everything end.

if u can pass me the version u r using..maybe i wouldn't have that error.

Thx again


kimss
User

Mar 18, 2004, 7:41 AM

Post #17 of 21 (7412 views)
Shortcut
Re: [rehab_shouman] PHP based Spell Checker [In reply to] Can't Post

Here is the version I downloaded and ran without any problems.

Remember to configure the script before you test it, the zip file attached is configured to run from e:\software\tools\speller and the aspell is installed at c:\Aspell

I didnt manage to do what I said in the previos post, since I suddenly got alot of work I have to finnish. When I manage to get some spare time Ill look into it.

Kim Steinhaug

Kim Steinhaug
kim-at-steinhaug-dot-com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Norwegian office : +47 88 00 92 45, Swedish office : +46 31 704 43 40
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Attachments: speller.zip (45.8 KB)


cayachris2
New User

Mar 19, 2004, 8:52 PM

Post #18 of 21 (7369 views)
Shortcut
Re: [kimss] PHP based Spell Checker [In reply to] Can't Post

ok i have it downloaded now and running of sorts but my link to the text form only returns html to be checked is there something i'm missing? if someone can tell me what the call is please?



Chris


cayachris2
New User

Mar 19, 2004, 10:12 PM

Post #19 of 21 (7367 views)
Shortcut
Re: [pvollma] PHP based Spell Checker [In reply to] Can't Post

hey i'm getting stuck can you tell me how you got the htmlarea text to load into the speller pages? also how did you get it to work from the spell checker icon?



need this then maybe I can get some sleep :)Smile



thanks


rehab_shouman
Novice

Mar 21, 2004, 3:55 AM

Post #20 of 21 (7343 views)
Shortcut
Re: [kimss] PHP based Spell Checker [In reply to] Can't Post

i have a very stupid problem and i don't know where is excatly the problem :

i have javascript error "Syntax error", and after alot of tracing the error i found the problem but i don't know the solution.

in spellchecker.php file, this part is what causing my problem:

<script language="javascript">
var suggs = new Array();
var words = new Array();
var textinputs = new Array();
var error;
<?php

print_textinputs_var();
print_checker_results();


?>

because the function "print_textinputs_var()" cause to print more than one line, so its like using document.write in javascript on more than one line and that gives error on javascript....!!!

i guess noone else is facing this problem, i don't know what difference do i have..is it the php version??? i'm really so confused.

THX in advance guys



cayachris2
New User

Mar 31, 2004, 9:53 PM

Post #21 of 21 (7179 views)
Shortcut
Re: [kimss] PHP based Spell Checker [In reply to] Can't Post

ok i'm still trying to get speller pages to work but can't get htmlarea into spell checker or out again please help.

 
 
 


Search for (options)