Results 1 to 3 of 3

Thread: Cool DHTML Tooltip > new line breaks the code

  1. #1
    Join Date
    Sep 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Cool DHTML Tooltip > new line breaks the code

    Hi,
    I am using the great Cool DHTML Tooltip
    http://www.dynamicdrive.com/dynamici...tmltooltip.htm
    but I have a small problem.

    I found out that a text like this:

    The flat is equipped with refrigerator, electric stove (upon request), electric kettle, dishes etc.
    We would be happy to meet your train and show you personally to the flat. We may also arrange for you a transport from the airport (extra paid about 15 euro).
    breaks the code because of the new line (when I remove it, it works).
    I am retrieving this text from database with php and there seem to be no way to actually remove that new line.
    I tried
    PHP Code:
    $descriptionrest =  addslashes(strip_tags(substr($description$startmore$maxlength)));
    $descriptionrest str_replace("\n"""$descriptionrest); // this removes the line break which breaks the java tooltip
    $descriptionrest =trim($descriptionrest); 

    A working example:
    http://www.myapartments.eu/Apartment...e-Lux-508.html

    and a non working one
    http://www.myapartments.eu/Apartment...Rydla-337.html

    I am using a function

    PHP Code:
    function dhtmltooltip($text$width)
    {
        
        
    $dhtmltooltip "onMouseover=\"ddrivetip('$text', '$width')\" ; onMouseout=\"hideddrivetip()\"";
        
        

        return 
    $dhtmltooltip;

    I am calling the function here:

    PHP Code:
    if ( strlen($description) >= $desclength) { $descmore "...(more) <img src=\"$server_root/images/arrowrightsm.gif\" border = 0 ".dhtmltooltip($descriptionrest300)." > ";}

    else {
    $descmore "";} 
    As I do not know Javascript, maybe there is an easy solution on the java side?
    I am lost now
    Thank you for your help!

    Bye

    Luca
    Last edited by lucadg; 09-05-2007 at 08:01 AM. Reason: making it more clear

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well, you may have to remove more than just the \n, sometimes a \r must also be removed to prevent a line from breaking.

    It would probably be best to simply manually remove the line-break from the database.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well, you may have to remove more than just the \n, sometimes a \r must also be removed to prevent a line from breaking.
    and that was it! Thank you!
    I wasn't even aware of the existance of |r

    It would probably be best to simply manually remove the line-break from the database.
    I have too many apartments to do that

    Anyway, solved, thank you!

    Luca

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
  •