PHP Classes

Thesaurus in specific text

Recommend this page to a friend!

      Thesaurus tooltip  >  All threads  >  Thesaurus in specific text  >  (Un) Subscribe thread alerts  
Subject:Thesaurus in specific text
Summary:Thesaurus in specific text
Messages:7
Author:Rodrigo
Date:2007-05-25 12:11:36
Update:2007-07-06 06:30:42
 

  1. Thesaurus in specific text   Reply   Report abuse  
Picture of Rodrigo Rodrigo - 2007-05-25 12:11:36
Congratulations for the project, use and work well. It would like to only know as to inside define thesaurus in a specific text of the page.

Example:
text text text text
text text text text
text text text text

--beginning thesaurus-----
text text text text
text text text text
text text text text
---end thesaurus--------

text text text text
text text text text...

Thanks for the help…

  2. Re: Thesaurus in specific text   Reply   Report abuse  
Picture of Dmitry Sheiko Dmitry Sheiko - 2007-05-29 11:45:36 - In reply to message 1 from Rodrigo
Sorry. I was out of the office. So can answer to you now. Of course you can limit an area of you pages to parse with Thesaurus. Change in your thesaurus.js the following lines:

function parseContent(){
var BodyObj = document.getElementsByTagName("BODY");
var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, pcallback, 'body='+encodeURIComponent(BodyObj[0].innerHTML));
}

Like this:

function parseContent(){
var BodyObj = document.getElementsById("mydiv");
var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, pcallback, 'body='+encodeURIComponent(BodyObj.innerHTML));
}

And lines:
var phandleSuccess = function(o){
if(o.responseText !== undefined){
var respondStructure = eval( '(' + o.responseText + ')' );
var BodyObj = document.getElementsByTagName("BODY");
if(respondStructure.content !== undefined) BodyObj[0].innerHTML = stripSlashes(respondStructure.content);
}
};

Like this:

var phandleSuccess = function(o){
if(o.responseText !== undefined){
var respondStructure = eval( '(' + o.responseText + ')' );
var BodyObj = document.getElementsById("mydiv");
if(respondStructure.content !== undefined) BodyObj.innerHTML = stripSlashes(respondStructure.content);
}
};

Where mydiv is name of ID in your block’s DIV (<div id=”mydiv”>text to parse</>)

As for UTF, try to set in your controller.php line header("Content-type: text/html; charset= iso-8859-1"); and use this charset on your HTML pages

  3. Re: Thesaurus in specific text   Reply   Report abuse  
Picture of Rodrigo Rodrigo - 2007-06-08 13:29:08 - In reply to message 2 from Dmitry Sheiko
Hi Sheiko,

I to solve the problems of the Thesaurus in relation to charset=iso and delimitations in the text.

It is not necessary more to be worried about this. Only help me in one another question: what is necessary to modify in controller.php so that the program reads as many very small words as capital in the archive csv (sample.csv).

Thanks for the support…

Delmar Haas
Brazil

  4. Re: Thesaurus in specific text   Reply   Report abuse  
Picture of Dmitry Sheiko Dmitry Sheiko - 2007-06-08 13:45:41 - In reply to message 3 from Rodrigo
Did you mean different recognizing upper and lower keys for trem dictionary? Modify line 42 of the controller

if(isset($_POST["term"])) $this->Term = strtolower($_POST["term"]);
to
if(isset($_POST["term"])) $this->Term = $_POST["term"];

  5. Re: Thesaurus in specific text   Reply   Report abuse  
Picture of Rodrigo Rodrigo - 2007-06-08 14:17:11 - In reply to message 4 from Dmitry Sheiko
Ok... Works 100%... Thanks!

  6. Re: Thesaurus in specific text   Reply   Report abuse  
Picture of simba2255 simba2255 - 2007-07-05 10:54:47 - In reply to message 2 from Dmitry Sheiko
Hi, Is there any way I can make thesaurus can have many dictionary sections one page?

For example

text text text text
text text text text
text text text text

--beginning thesaurus-----
text text text text
text text text text
text text text text
---end thesaurus--------

text text text text
text text text text...

--beginning thesaurus AGAIN-----
text text text text
text text text text
text text text text
---end thesaurus AGAIN--------

Thanks in advance for the help…

Regards

  7. Re: Thesaurus in specific text   Reply   Report abuse  
Picture of Dmitry Sheiko Dmitry Sheiko - 2007-07-06 06:30:42 - In reply to message 6 from simba2255
Just specify in your text the blocks to parse

<div id="Block1">text text</div>
text text
<div id="Block2">text text</div>

and change function of thesaurus.js - parseChildNodes() in the following way:

function parseChildNodes(obj) {
for (var i=0; i<obj.childNodes.length; i++) {
if( obj.childNodes[i].childNodes.length>0 &&
obj.childNodes[i].id=="Block1" &&
obj.childNodes[i].id=="Block2")
parseChildNodes( obj.childNodes[i] );
else parseText( obj.childNodes[i] ) ;
}
}