Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
definition-in-a-tooltip script needed
Old 04-07-2005, 09:13 PM definition-in-a-tooltip script needed
sallam's Avatar
Average Talker

Posts: 23
Trades: 0
Hi

I need, or looking for, a script that brings definitions of words in large tooltips when the word is moused over.
I need it for my invision board forum (IPB), so that whenever these words are posted, they get automatically tooltipped with the definition that I prepared for it in an external text file.

Please have a look at this example from Culombia Encyclopedia:
http://columbia.tfd.com/egypt

I need it to be able to show several lines of text, unlike html title tag's limitations.

Can someone please make me such script? be it javascript or php?
Or lead me to where I can find it?

Many thanks in advance
sallam is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-08-2005, 06:20 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
That looks like a DHTML job to me, I know nothing about it, but you can certainly use PHP to automatically generate it.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 04-08-2005, 07:37 AM
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
Trades: 0
http://www.webreference.com/js/column16/index.html
doesnt seem to work in firefox though. Will continue searching for you.

This might help: http://www.milonic.com/menusample6.php
__________________
Yes, indeed...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by brokensoul2271; 04-08-2005 at 07:40 AM..
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
Old 04-08-2005, 04:13 PM
sallam's Avatar
Average Talker

Posts: 23
Trades: 0
I found a good script, but I need help to chage its usage.
It basically uses a text file to search keywords, and if found it links the word with the url from the text file, and give the link a little definition. The text file has each keyword in a separate line in thae following form:

keyword|URL|definition

I need to remove the URL part, and replace the url with:
<u class=info>keyword<span>definition</span></u>
(It uses a nice CSS rule to give pure CSS tooltips)

Here is the php script:

PHP Code:
<?

/*

    Word2URL Modification (Version 1.52)
    Programmed by: primetime
    Module Id: 1060805578
    Bugfix: 001

    ------------------------
    
    This script cannot be distributed without the permission of the original author.
    
*/

    
class Word2URL
    
{
        function 
openData($txt)
        {
            global 
$ibforums;
            
            if(!isset(
$ibforums->input['preview']))
            {
                
$i    0;
            
                
$data file('./mods/word2url.txt');
            
                foreach(
$data as $line)
                {
                    list(
$key[$i], $link[$i], $tooltip[$i]) = explode("|"$line);
                
                    
// Clean up the data before we do anything nasty to it
                
                    
$key[$i] = preg_quote(trim($key[$i]), "/");
                    
$link[$i] = trim($link[$i]);
                    
$tooltip[$i] = trim($tooltip[$i]);
                                                            
                    
// Search the text for the "keywords" and auto-link them    
                    
                        
if($key[$i] != "")                
                        {    
                            
$txt preg_replace("#\b".$key[$i]."\b#is""[autolink]\\0[/autolink]"$txt);
                            
$txt preg_replace("#\[url.+?\[\/url\]#ies""Word2URL::cleanUp('\\0')"$txt);
                            
$txt preg_replace("#\[autolink\]".$key[$i]."\[\/autolink\]\.com#ies""Word2URL::cleanUp('\\0')"$txt);
                            
$txt preg_replace("#<.+".$key[$i].".+>#ies""Word2URL::cleanUp('\\0')"$txt);
                        
                            
$txt preg_replace("#\[autolink\]".$key[$i]."\[\/autolink\]#ies""Word2URL::createLink('\\0', '$link[$i]', '$tooltip[$i]')"$txt);
                        }
                                            
                    
$i++;

                }
                    
$txt Word2URL::cleanUp($txt);
            }
            
                return 
$txt;
            
            
        }
        
        function 
createLink($key$url$def)
        {
            if(
$key != "")
            {
                return 
"<!--WORD2URL-01--><a href='".$url."' title='".$def."' target='_blank'><!--END WORD2URL-01-->".$key."<!--WORD2URL-02--></a><!--END WORD2URL-02-->";
            }
            else
                return 
$key;
        }


        
        function 
unLink($txt)
        {
            
$txt preg_replace("#<!--WORD2URL-01-->.+?<!--END WORD2URL-01-->#is"""$txt);
            
$txt preg_replace("#<!--WORD2URL-02-->.+?<!--END WORD2URL-02-->#is"""$txt);
            return 
$txt;
        }
        
        function 
cleanUp($txt)
        {
            
$txt preg_replace("#\[autolink\]#is"""$txt);
            
$txt preg_replace("#\[\/autolink\]#is"""$txt);
            return 
$txt;
        }
        
    }    
?>
sallam is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to definition-in-a-tooltip script needed
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16816 seconds with 12 queries