+ Reply to Thread
Results 1 to 4 of 4

Thread: wayward div

  1. #1
    garrensilverwing's Avatar
    garrensilverwing is offline x10 Sophmore garrensilverwing is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    148

    wayward div

    http://war2ladder.x10hosting.com/record.php/php?player1=$paCe&player2=S9isDragon

    when you look at this page in firefox or safari it looks perfectly fine, but if you look at it in IE7 or 8 (i havent checked 6 cause mine is broken for some reason) the Games div floats way off to the right. I could not tell why it was doing this here is my code:

    PHP Code:
    <html>
    <?php
        
    include_once("functions.php");
        include_once(
    "db_connect.php");
        
    $Player1 $_GET['player1'];
        
    $Player2 $_GET['player2'];
        
    $Offset $_GET['offset'];
        if(!
    $Offset$Offset 0;
        
    $result mysql_query("SELECT Winner FROM checkedgames WHERE Winner LIKE '$Player1' AND Loser LIKE '$Player2' OR Winner LIKE '$Player2' AND Loser LIKE '$Player1'") or die(mysql_error());
        
    $Player1Wins 0;
        
    $Player2Wins 0;
        while(
    $row mysql_fetch_array($result))
            {
                
    $GameWinner $row['Winner'];
                if(
    $GameWinner == $Player1$Player1Wins $Player1Wins 1;
                if(
    $GameWinner == $Player2$Player2Wins $Player2Wins 1;
            }
        
    $Record "Current 1v1 Record: <strong>$Player1Wins - $Player2Wins</strong>";
    ?>
    <head>
    <link rel="stylesheet" type="text/css" href="http://<?php echo $_SERVER[SERVER_NAME]; ?>/style.css" />
    <title><?php echo "$Player1 - $Player2 Record * War2Ladder ";?></title>
    </head>
    <body>
    <div id="wrapper" class="Wrapper">
    <?php masthead(); ?>
    <div id="stats" class="Stats">
    <?php
        
    echo "<h3>Games between <a href=\"http://".$_SERVER[SERVER_NAME]."/player.php/php?player=$Player1\">$Player1</a> and <a href=\"http://".$_SERVER[SERVER_NAME]."/player.php/php?player=$Player2\">$Player2</a>";
        echo 
    "<h4>$Record</h4></div>\n";
    ?>
        <div id="GamesWrapper" class="GamesWrapper"><div id="Games" class="Games"><h4><ul>
    <?php
        $games 
    mysql_query("SELECT * FROM checkedgames WHERE Winner LIKE '$Player1' AND Loser LIKE '$Player2' OR Winner LIKE '$Player2' AND Loser LIKE '$Player1' ORDER BY DateT DESC LIMIT 10 OFFSET $Offset") or die(mysql_error());
        while(
    $row mysql_fetch_array($games))
            {
                
    $GameID $row['GameID'];
                
    $Winner $row['Winner'];
                
    $Loser $row['Loser'];
                
    $Map $row['Map'];
                
    $DateT $row['DateT'];
                
    $Year substr($DateT04);
                
    $Month substr($DateT42);
                
    $Day substr($DateT62);
                
    $Hour substr($DateT82);
                
    $Minute substr($DateT102);
                
    $Second substr($DateT122);
                
    $DateT "$Hour:$Minute:$Second on $Month/$Day/$Year";
                
    $WOldRank $row['WOldRank'];
                
    $WNewRank $row['WNewRank'];
                
    $LOldRank $row['LOldRank'];
                
    $LNewRank $row['LNewRank'];
                
    $WOldRank $row['WOldRank'];
                
    $WNewRank $row['WNewRank'];
                
    $LOldRank $row['LOldRank'];
                
    $LNewRank $row['LNewRank'];
                
    $LRank Rank($LOldRank,$LNewRank);
                
    $WRank Rank($WOldRank,$WNewRank);    
                echo 
    "<li><a href=\"http://".$_SERVER[SERVER_NAME]."/player.php/php?player=$Winner\">$Winner</a> ($WRank) defeated <a href=\"http://".$_SERVER[SERVER_NAME]."/player.php/php?player=$Loser\">$Loser</a> ($LRank) on \"$Map\" at <a href=\"http://server.war2.ru/reports/$GameID\" target=\"_blank\">$DateT</a>.</li>\n";
            }
    ?>
    </ul></h4></div></div><div id=\"FooterLinks\" class=\"FooterLinks\">
    <?php
        TablePages
    ($Offset,$Player1,$Player2,$result);
    ?>
    <h5 style="text: x-small; font-weight: normal;">All Times are in MSK (UTC +3).</h5></div>
    <?php
         
    function TablePages($Offset,$Player1,$Player2,$result)
        {
            
    $count mysql_num_rows($result);
            if(
    $count 10)
                {
                    if(
    $Offset == 0)
                        {
                            
    $Offset 10;
                            
    $LinkString "<a href=\"http://".$_SERVER[SERVER_NAME]."/record.php/php?offset=$Offset&player1=$Player1&player2=$Player2\">Next Page >></a>";
                        }
                    else
                        {
                            if(
    $count $Offset 10)
                                {
                                    
    $NextPage $Offset 10;
                                    
    $PrevPage $Offset 10;
                                    
    $LinkString "<a href=\"http://".$_SERVER[SERVER_NAME]."/record.php/php?offset=$PrevPage&player1=$Player1&player2=$Player2\"><< Previous Page</a><span style=\"color:#005DB3\">  | </span><a href=\"http://".$_SERVER[SERVER_NAME]."/record.php/php?offset=$NextPage&player1=$Player1&player2=$Player2\">Next Page >></a>";
                                }
                            else
                                {
                                    
    $PrevPage $Offset 10;
                                    
    $LinkString "<a href=\"http://".$_SERVER[SERVER_NAME]."/record.php/php?offset=$PrevePage&player1=$Player1&player2=$Player2\"><< Previous Page</a>";
                                }
                        }
                }
            echo 
    $LinkString;
        }
    ?>
    </div>
    </body>
    </html>
    Code:
    ul { 
        text-align: left;
        list-style-type: none;
        margin-top = .5em;
    }
    li {
        padding: 2px;
    }
    .GamesWrapper {
        text-align: center;
        position: relative;
        border: thin #CCC solid;
        padding: 5px;
        width: 95%;
        margin-right: auto;
        margin-left: auto;
        margin-bottom: 15px;
    }
    .Games{
        height: 295px;
    }
    table{
        position: relative;
        text-align: center;
        color: #02243C;
        background-color: #F9F9F9;
        border: thin #02243C solid;
        width: 75%;
        margin-left: auto;
        margin-right: auto;
        border-collapse: collapse;
    }

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: wayward div

    For reference, attached are screenshots of MSIE 6/Win2k & 8/XP (generated by browsershots) and Safari 4 illustrating the behavior.

    The document isn't valid HTML 4, transitional or strict. In particular, there's:
    • an unclosed <h3>
    • a <ul> as a child of a <h4> (headings can only have inline elements as children)
    • the double quotes around the values for the attributes of #FooterLinks are escaped
    <h?> are header elements, and should only be used for headings. That might be throwing IE off.

    Edit: the unclosed <h3> is the culprit. You should also remove the <h4> around the <ul>. Just goes to show the value of validation.
    Attached Thumbnails Attached Thumbnails wayward div-msie-6.0-windows-2k.png   wayward div-msie-8.0-windows-xp.png   wayward div-safari-4-mac-tiger.png  
    Last edited by misson; 12-13-2009 at 05:24 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  3. #3
    garrensilverwing's Avatar
    garrensilverwing is offline x10 Sophmore garrensilverwing is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    148

    Re: wayward div

    ah ok, i wasnt sure how to go about validating a php document but i guess i could have just got the source from the output and validated that! thanks a lot misson! problem solved, also i removed the <h4> parent thing...

  4. #4
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: wayward div

    Quote Originally Posted by garrensilverwing View Post
    i could have just got the source from the output and validated that!
    No need for that. The W3C validator takes a URL.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers