#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    7
    Rep Power
    0

    could you help me to find the way to show term definitions over tooltips?


    Dear PHP friends!

    I was looking for a little tooltip PHP based script for giving some good definitions on my website and finally I couldn't manage to get anything really nice. Then, I saw the tooltips shown on the articles offered by this site (see an example here: http://www.devshed.com/Server_Side/J...ng2/page1.html) and it's really cute. You know, some kind of mouseover code to get a popup and there the term definition in a PHP page.

    Could any of you point me to a similar solution (or this one implemented by site webmaster) to get this kind of tooltips working? I have been looking the overLIB doc for example but it's not under the way I am. It's managing link by link, getting in the code the definition and I would like to use something based on a external database, or in a configuration file, or plain text file or something where I could change for all the site at the same time. I don't know how is workin at devshed but it seems the script parse all the html output on the page to put the links and tooltips code at the end of the process. Maybe that's the way to proceed with some kind of parse script that search and replace?

    Could you help me to find something similar? Thank you very very much! :-)

    PS. I browsed old topics and posts for a couple of hours and I didn't find this information. I found some complaints about the script putting toltips in user names at this forum but no way to setup or get this great feature. Thank you again!
  2. #2
  3. Rut row Raggy!
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    Tornado Alley
    Posts
    560
    Rep Power
    31
    Does it have to be written in PHP? I found a very nice small JavaScript program that made some nice tips for my site!
    Matt
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    7
    Rep Power
    0
    No man, any script coold be great :-) Let me know what are you thinking about, please!

    Thank you very much for your help!
  6. #4
  7. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    this any good?

    --IN HEADER--

    <script language="javascript1.2">

    function showtip(current,e,text)
    {
    if (document.all)
    {
    thetitle=text.split('<br>')
    if (thetitle.length > 1)
    {
    thetitles=""
    for (i=0; i<thetitle.length; i++)
    thetitles += thetitle[i] + "\r\n"
    current.title = thetitles
    }
    else current.title = text
    }

    else if (document.layers)
    {
    document.tooltip.document.write(
    '<layer bgColor="#FFFFE7" style="border:1px ' +
    'solid black; font-size:12px;color:#000000;">' + text + '</layer>')
    document.tooltip.document.close()
    document.tooltip.left=e.pageX+5
    document.tooltip.top=e.pageY+5
    document.tooltip.visibility="show"
    }
    }

    function hidetip()
    {
    if (document.layers)
    document.tooltip.visibility="hidden"
    }
    </script>

    --LINKS IN THE PAGE--

    <a onmouseover="showtip(this,event,'MY TIP HERE')" onmouseout="hidetip()" href="#">link</a>
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    7
    Rep Power
    0
    Thank you ralphuk100 for your hint, but if I'm not wrong I would add the tips in every term I want to define. Iwas looking for some kind of automated function, so I can define before all the terms and then the script will detect the terms into the text and add the tooltips (parsing the code or something similar).

    I saw this function in a CMS but I don't want to use it. Only some hints to parse the code and put there the tooltips. Maybe put all the definitions in the header and make some kind of replacement to put the term, its definition and the tooltip code when it's needed? No idea at all :-)

    Thank you for any input here!
  10. #6
  11. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    well this is effectively what the script I gave you does. Except that instead of defining all the tips at the top of the page you are defining them within the onMouseOver. Whats the difference? Its the same thing except your way you would have the tips at the top, and then each bit you wanted a tip on would have to have the onmouseover calling that tip anyway. Im not sure what you mean.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    7
    Rep Power
    0
    Sorry, maybe I didn't explain it well :-) I was meaning that this method makes me to insert every defintion every time, and if I want to change it I have to go thru the code and edit. That's the way overLIB also works if I understand what you kindly proposed me.

    What I would like to see is something to separate definitions from mouseover code, so I can add more terms to the script or change them and I always see the update version. I was considering a way that uses the header because I could use a include or something similar under PHP and get into all the pages all the code and proper definitions on the fly. I was only sugesting in case any of you know how to get it running.

    Thank you for your time and let's see if I explained it better :-)
  14. #8
  15. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    just make an array in the header of all your definitions and then instead of putting the definition in the onMouseOver just put a call to the right array item?
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    7
    Rep Power
    0
    well, it seems you got it, but could you please point me to an example to have a look? The essential idea would be to allow the script to detect terms into the text and add the code to show the defintions. I'm not a deep PHP developer and it's a bit difficult for me to get an idea about how go for that

    Also, I don't know what was marron79 thinkinbg about. Are you near to ralphuk100 idea?

    Thank you very much!
  18. #10
  19. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    aah... you mean like if a page contains the phrase "php" or "help" then it becomes highlighted and when the mouse goes over it shows a tip?
  20. #11
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    7
    Rep Power
    0
    yeah, that's the key! I understand the example I gave at the begining is doing something similar :-)

    See here for example:
    http://www.devshed.com/Server_Side/J...ng2/page1.html

    Any thoughts?

    Thank you again!!!
  22. #12
  23. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,186
    Rep Power
    2265
    Moved to Scripts forum from PHP board.
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
  24. #13
  25. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    7
    Rep Power
    0
    thank you drgroove, and excuse me for posting in the wring forum but i thought the idea would come over php development. And, excuse me, do you know anything about the script used on the docs i'm linking as examples here at devshed?

    Ayway, any one here have any hint for what I'm trying to do? Thank you again in advance!
  26. #14
  27. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    1
    Rep Power
    0
    Hi there!

    Newbie over here with the same exact inquiry. I've looked into the DHTML Tooltips and Javascript tips but they all require manual coding of each and every term.

    I was wondering if there is any way at all to have the script reference an include script or a db of some type that has all the terms to look for and upon finding them, apply the tool tip (i'm doing this for definitions on a medical site, so to go through and do every definition would be BEYOND time consuming).

    Any help you can offer would be GREATLY appreciated!

    Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo