Hello,

I tried the latest version of glossify, and only the Link style ok glossary terms worked :
for Hovertips, the terms are well replaced, but nothing happend at roll over. I watched the code, for example, for one of my terms i get this in the body :

<span hovertip="feugiat" class="glossify_term hovertip_target">feugiat</span>
And this at the end of the page :

<div class="hovertip_wrap0" style="display: none;">
  <div class="hovertip_wrap1">
    <div class="hovertip_wrap2">
      <div style="display: block;" class="hovertip hovertip_wrap3" id="">
        <h1></h1>
        <p></p>
      </div>
    </div>
  </div>
</div>

But you can see that the node value is empty. I don't see common reference to link the two elements, and then no javascript is launched at rollover.
The javascript problem may come from a bad configuration of the hovertip module, because I didn't found any documentation, and I don't know how to make it work ; but it can't explain the emptyness of the term definition ; in "hovertip" and "reference section under content" case.

I already use Jquery with the JqueryTools module. But it is suoposed to execute only in a specified block ; so I don't think it comes from here.

Do you see where the problem could come from ?

Thanks for your help ;)
... and sorry for my bad english ^^

Comments

rsvelko’s picture

your english is good.

1. What above is empty?
2. These features are untested.
3. Patches for them are welcome. I myself do not have time for that.

Ivo.Radulovski’s picture

you could try an older version (1.x) for now - hovertips should work there

seren10pity’s picture

Hello,

what is empty is the hovetip div : the

and

don't have the node content inside.

I'll try to make it work, and patch if it's working ;)
thanks Segments, I'll try the 1.x version to compare.

zog_zog’s picture

Hi all,

I've got the exactly same problem. After a short dive in glossify.module, here is what I found:

The theme_glossify_term function expects a term nid, but receives a "node/__nid__", as found in the the global dictionnary. I don't understand how it can work... I guess I could make it work by writing my own theme function, which would parse basck the nid from the argument passed, but I guess you would like this to work out of the box.

Any help is welcome

seren10pity’s picture

Hi,

Same finding here.

To make it work, I replaced :
$term = node_load($nid);
by

$nid = split  ('/' , $nid);
$nid = $nid['1'];
$term = node_load($nid);

to load the node with the nid.

I added this after node load for the case the node body is realy long :

$hovertip_text = '';
//if body is longer than teaser
	if(mb_strlen($term->body) > mb_strlen($term->teaser)){
		$hovertip_text = $term->teaser . ' [<a class="plus" href="/node/'. $nid .'">'. t('read more') .'</a>]';
	}else{
		$hovertip_text = $term->body;
	}

and then in the switch ($glossify_style) { [...] default : , I replaced the body output by $output .= $hovertip_text;

To search words with insensitive case, I added a i at the end of the regexp in function __glossify_convert_string_array_to_array_of_escaped_regexps($needles) :

       $regexps[] = "/\b" . preg_quote($needle, "/") . "\b/i";

The the problem was the word replacements used the glossary terms titles instead of the found terms, so all replaced words had the first letter in capital.
What I tried next is dirty, and creates other bugs, but it solved that problem. so :

In function __glossify_replace, I used preg_replace_callback instead of preg_replace to use the word found instead of the glossary term title :

function __hovertip_replacement($matches){
	return '<span class="glossify_term hovertip_target" hovertip="'.$matches[0].'">'.$matches[0].'</span>';
}

function __glossify_replace($needles, $replacements, $haystack) {
[...]
$haystack = preg_replace_callback( __glossify_convert_string_array_to_array_of_escaped_regexps($needles), '__hovertip_replacement', $haystack, $number_of_replacements);
[...]
//you have to comment htmlentities or the replacement shows html tags in your body ... And that's where it becomes realy dirty because doing this affects the others glossify styles.
//$haystack = htmlentities($haystack, ENT_COMPAT, "UTF-8");

return $haystack;
}

So this solves the words capitals problem, but now I can't see hovertip for words that have not the same case in the body and in the glossary, maybe because the id's are not corresponding between span words and hovertip definition blocks.

So Now, I don't know how to go further without doing big dirty mess.

Could someone help me to make glossify hovertip work neatly , what means find a way to use corresponding ids in the body hovertip spans, and in the definition blocks ; and make it work for french accented caracters.

Thanks,

Seren10pity

seren10pity’s picture

To make all the hovertip definition blocks being created, we must search terms with case insensitive pattern too.

so, in glossify_nodeapi function, in switch ($op) { [...] case 'view': , in case 'hovertip' and case 'reference' , in the preg replace, add a i after the pattern definition :

if (preg_match('/' . preg_quote($term_title, '/') . '/i', $node_body)) {

instead of

if (preg_match('/' . preg_quote($term_title, '/') . '/', $node_body)) {

Before, all terms were found in body, but only the blocks corresponding to case sensitive matches were created. Now, they're all created.

I still have to make it work for words with accents, and it will rock ;)

seren10pity’s picture

I don't understand why :
In function __glossify_replace($needles, $replacements, $haystack) {
If I print the regexps, and the hayshack (corresponding to the node body) just before the execution of the preg_replace, both are containing the word "accentué" ; but it looks that the preg_replace doesn't detect it.

but in glossify_nodeapi function the preg match that launch the creation of the hovertips blocks detects it !

So I have a hovertipblock created at the end of my page, in display none, but I don't have the corresponding span that highlight the word in my text !

I tried to uncomment the $haystack = html_entity_decode($haystack, ENT_COMPAT, "UTF-8"); at the start of function __glossify_replace ; but it doesn't seem to change anything.
I tried many other things like htmlentities, encode, decode etc. but nothing works...

So please, help ^^

bchoc’s picture

How is it functioning for you presently? Can your changes be made into a patch?

Ivo.Radulovski’s picture

Version: 6.x-2.5 » 6.x-3.0-beta1
Status: Active » Closed (fixed)

Hello we have fully rewritten the Glossify module.

The 2.x version will not be supported any more

Version 3.x supports hovertips again.