Results 1 to 5 of 5

Thread: A question about "Cool DHTML Tooltip"

  1. #1
    Join Date
    Jan 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default A question about "Cool DHTML Tooltip"

    1) Script Title: Cool DHTML Tooltip

    2) Script URL (on DD):http://www.dynamicdrive.com/dynamici...tmltooltip.htm

    3) Describe problem:
    My website displays in three different languages. A routine selects the appropriate language text string, places it into a variable and cranks up the display routine.

    Is it possible to use a variable instead of the 'text string' with this script. If so, do I just enter it aws '$variable'?????

    Thanks.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    This should be possible. What programming language are you using for these variables? The $ makes me think that it is PHP.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jan 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    This should be possible. What programming language are you using for these variables? The $ makes me think that it is PHP.
    Thank you for the quick reply.

    I have a PHP routine that holds all of the text declarations, one file for each language.

    My text statement in the English file looks like this:

    $text ['hlp_home'] = "Home - Takes you to the front page of the this website.";

    There is an equivalent in Spanish and German each in its own language file.

    The routine that uses this is HTML with some PHP in line. I modded the statement to test the tooltip, it works as advertised and looks like this:

    <img border="0" src="img/tng_home.gif" align="middle" width="20" height="20" onMouseover="ddrivetip('Click to return to home page')";
    onMouseout="hideddrivetip()">

    I solved something similar to this, by putting the entire HTML statement into a text string, and I got that to work. It looks like this:

    $text ['menupic'] = "<img border=\"0\" src=\"img/AncChrtMiniUSA.jpg\" width=\"744\" height=\"669\">";

    I added this code to the HTML file and it works.

    <?php
    echo $text['menupic'];
    ?>

    When I tried to use this approach with the function in the statement, all I got was the text string printed out.

    Any suggestions would be greatly appreciated.

    Thank you,
    Klaus Dieter Cook
    Houston, Texas

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You will need to generate the Javascript using PHP, by echoing that variable where the string will be for the Javascript. It will be something like this:
    Code:
    var stringname = '<?php echo $text['mytext']; ?>';
    Of course this means including this part of the Javascript within the page's code rather than in an external .js file.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. The Following User Says Thank You to djr33 For This Useful Post:

    CaseyC (01-12-2011)

  6. #5
    Join Date
    Jan 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thank you Daniel. While I was waiting, I played around some more with the method of declaring the entire HTML statement as a text string in my individual language folders. I finally got it to work. My "expertise" in php was at fault. I had originally included escape characters (\) for all the quotes AND the single quotes in the text string. Once I removed the back slash from the single quote it worked.

    Again, thank you for your expertise.......if you ever need to solve a problem in ASM or Fortran, feel free to ask.....lol.......I am showing my age here.

    Mit freundlichen Grüßen von Houston, TX
    Klaus Dieter Cook
    Houston, Texas

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •