Advanced Search

Results 1 to 2 of 2

Thread: is it possible to add 'sticky tooltip' within php?

  1. #1
    Join Date
    Feb 2010
    Location
    Falkirk, Scotland
    Posts
    142
    Thanks
    21
    Thanked 4 Times in 4 Posts

    Default is it possible to add 'sticky tooltip' within php?

    hey guys, i am wondering if it is possible to implement the 'DD sticky tooltip' script into a map on my site?

    atm, when u hover over the citys on the map, the tooltip appears, but all the citys have the same info(within the tooltip)

    here is a link to the page

    and here is my code:
    PHP Code:
    <!--grid table-->
    <table width="100%" height="100%" cellspacing="0" cellpadding="2" border="0" bgcolor="#009900">
    <?php
    //these 2 for loops represent the y and x axis
    //using the data collected above the loops will properly display the grid
    for ($Ty $start_y$Ty <= $end_y$Ty++) {
        
    //start new row
        
    echo '<tr>';
        for (
    $Tx $start_x$Tx <= $end_x$Tx++) {
            
    //show grid
            
    DisplayGrid($Tx,$Ty);
        }
        echo 
    '</tr>';
    }
    ?>



    <?php

    function DisplayGrid($gridx,$gridy) {
        global 
    $x$y;
        
        
    //process.php
    $host="localhost";
    $username="username";
    $password="password";
    $db_name="database";
    $tbl_name="table";

    mysql_connect("$host""$username""$password")or die("cannot connect to server");
    mysql_select_db("$db_name")or die("cannot select db");
    $query mysql_query("SELECT * FROM `mapdata`") or die(mysql_error());
        while(
    $rows=mysql_fetch_array($query)){
            
        
    $id $rows['id'];
        
    $status $rows['status'];
        
      if (
    $gridx == $rows['x'] && $gridy == $rows['y']) {
          
          if(
    $status == 'FRIENDLY'){
            echo 
    "<td style=\"border: 1px;\" width=7  bgcolor=\"#00FFFF\" align=center valign=center data-tooltip=\"sticky1\"><font size='1'></font></td>";
     
    ?>
           <div id="mystickytooltip" class="stickytooltip">
           <div style="padding:5px">

           <div id="sticky1" class="atip" style="width:200px">
            <? echo $rows['x']; ?><? echo $rows['y']; ?><br />
          <img src="../friendly.jpg" alt=""/><br />
          <b>Lord Name:</b> <? echo $rows['lordname']; ?><br />
            <b>Alliance:</b> <? echo $rows['alliance']; ?>
            
           </div>
         </div>
            <div class="stickystatus"></div>
            </div>
            <?
          
    }
          if(
    $status == 'HOSTILE'){
            echo 
    "<td style=\"border: 1px;\" width=7  bgcolor=\"#FF0000\" align=center valign=center data-tooltip=\"sticky2\"><font size='1'></font></td>";
     
    ?>
           <div id="mystickytooltip" class="stickytooltip">
           <div style="padding:5px">
           <div id="sticky2" class="atip" style="width:200px">
            <? echo $rows['x']; ?><? echo $rows['y']; ?><br />
          <img src="../hostile.JPG" alt=""/><br />
          <b>Lord Name:</b> <? echo $rows['lordname']; ?><br />
            <b>Alliance:</b> <? echo $rows['alliance']; ?>
            
           </div>
          </div>
            <div class="stickystatus"></div>
            </div>
            <?
          
    }
                
          }
        
      }
        echo 
    "<td width=7 align=center valign=center><a href=\"index.php?xcord=$gridx&ycord=$gridy\"></a><font size=1></font></td>";
            
            
    }
    ?>
    </table>
    this is the only thing that really needs fixing on the map so ur help will be appreciated

    thanx

  2. #2
    Join Date
    Feb 2010
    Location
    Falkirk, Scotland
    Posts
    142
    Thanks
    21
    Thanked 4 Times in 4 Posts

    Default

    a little more info:
    the citys all show on the map, the friendly citys all show the same details in popup even though it is obvious all the citys coordinates are different, and the hostile citys show no details at all in popup.

    i am so close to finishing this map, this is the only major problem with it so if someone has a solution for it, that would be brill

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
  •