Results 1 to 5 of 5

Thread: php table INCLUDE

  1. #1
    Join Date
    Mar 2008
    Posts
    58
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Default php table INCLUDE

    What I am making is a CS:Source player ranking page for my CS server.

    preview: http://psiclocybin.clanservers.com/

    its only two columns, i want to add two more, but thats easy, here is how i approached it.

    what I do not get is why it isnt displaying xx2.php in the desired columns..

    heres the tut i used: http://css-iceworld.com/howtos/sitestats.php
    PHP Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>«PSiLOCYBiN GAMiNG RANK»</title>
    <style type="text/css">
    body {
    background-color:#000000
    }
    <!--
    .style6 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; font-weight: bold; color: #999999; }
    -->

    table {vertical-align:middle}
    </style>
    </head>
    <body>

    <table width="900" border="1" align="center" cellpadding="0" cellspacing="0">
        
        <tr>
        <td><span class="style6">Player</span></div></td>
        <td><span class="style6">K/D</span></div></td>
        </tr>
        <? include("xx2.php"); ?>

        <tr>
        <td><span class="style6">test</span></div></td>
        <td><span class="style6">test</span></div></td>
        </tr>
        <? include("xx1.php"); ?>
    </table>

    </body>
    </html>
    xx1.php
    PHP Code:
    <?php

    //How many rows of results would you like? (ex. if you're looking for the Top10, enter //10 here.
    $limitresults=200;
    //How many characters long would you like each string (players name), before its //replaced with "...".
    $trunication=40;
    //Location of your mani_ranks.txt file. It can be a URL or a direct link to the file (i.e. //http://server.com/mani_ranks.txt or data/mani_ranks.txt
    $manirankslocation="ftp://xxxx:xxxx@208.167.247.221/css/208.167.247.221:27015/cstrike/cfg/mani_admin_plugin/data/mani_ranks.txt";

    //These are color codes used to alternate background colors between results.
    $bgcolor1="333333";
    $bgcolor2="e91f7a";

    //DO NOT CHANGE (opens the mani_ranks.txt file)
    $handle fopen($manirankslocation"r");

    //DO NOT CHANGE
    function trunicate ($string$max 50$rep '') {
    $leave $max strlen ($rep);
    return 
    substr_replace($string$rep$leave);
    }

    $row 0;
    //DO NOT CHANGE
    while (($data fgetcsv($handle1000",")) !== FALSE) {
    $num count($data);

    $row_color = ($row 2) ? $bgcolor2 $bgcolor1;

    if(
    $row $limitresults){

    if(
    strlen($data[64]) > $trunication){
    //Change the HTML Code between the ""'s to what you need it to be
    echo "<tr><b><td bgcolor='$row_color'><b><font face=Verdana, Arial, Helvetica, sans-serif font size=-6>" trunicate($data[64], $trunication,'...') . "</font></b></td>";
    echo 
    "<td bgcolor='$row_color'><b><font face=Verdana, Arial, Helvetica, sans-serif font size=-6>" $data[7] . ":" $data[5] . "</font></b></td></b></tr>";
    }else{
    echo 
    "<tr><td bgcolor='$row_color'><b><font face=Verdana, Arial, Helvetica, sans-serif font size=-6>" $data[64] . "</font></b></td>";
    echo 
    "<td bgcolor='$row_color'><b><font face=Verdana, Arial, Helvetica, sans-serif font size=-6>" $data[7] . ":" $data[5] . "</font></b></td></b></tr>";
    }

    }
    $row++;
    }

    fclose($handle);
    ?>
    xx2.php
    PHP Code:
    <?php

    //How many rows of results would you like? (ex. if you're looking for the Top10, enter //10 here.
    $limitresults=200;
    //How many characters long would you like each string (players name), before its //replaced with "...".
    $trunication=40;
    //Location of your mani_ranks.txt file. It can be a URL or a direct link to the file (i.e. //http://server.com/mani_ranks.txt or data/mani_ranks.txt
    $manirankslocation="ftp://xxxx:xxxx@208.167.247.221/css/208.167.247.221:27015/cstrike/cfg/mani_admin_plugin/data/mani_ranks.txt";

    //These are color codes used to alternate background colors between results.
    $bgcolor1="333333";
    $bgcolor2="e91f7a";

    //DO NOT CHANGE (opens the mani_ranks.txt file)
    $handle fopen($manirankslocation"r");

    //DO NOT CHANGE
    function trunicate ($string$max 50$rep '') {
    $leave $max strlen ($rep);
    return 
    substr_replace($string$rep$leave);
    }

    $row 0;
    //DO NOT CHANGE
    while (($data fgetcsv($handle1000",")) !== FALSE) {
    $num count($data);

    $row_color = ($row 2) ? $bgcolor2 $bgcolor1;

    if(
    $row $limitresults){

    if(
    strlen($data[64]) > $trunication){
    //Change the HTML Code between the ""'s to what you need it to be
    echo "<tr><b><td bgcolor='$row_color'><b><font face=Verdana, Arial, Helvetica, sans-serif font size=-6>" trunicate($data[64], $trunication,'...') . "</font></b></td>";
    echo 
    "<td bgcolor='$row_color'><b><font face=Verdana, Arial, Helvetica, sans-serif font size=-6>" $data[7] . ":" $data[5] . "</font></b></td></b></tr>";
    }else{
    echo 
    "<tr><td bgcolor='$row_color'><b><font face=Verdana, Arial, Helvetica, sans-serif font size=-6>" $data[64] . "</font></b></td>";
    echo 
    "<td bgcolor='$row_color'><b><font face=Verdana, Arial, Helvetica, sans-serif font size=-6>" $data[7] . ":" $data[5] . "</font></b></td></b></tr>";
    }

    }
    $row++;
    }

    fclose($handle);
    ?>

  2. #2
    Join Date
    Jan 2008
    Posts
    4,167
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    So whats your problem? Do you want us to help you insert the two extra columns?
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2008
    Posts
    58
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    So whats your problem? Do you want us to help you insert the two extra columns?
    no i already did that, i want the two extra columns to use the data in xx2.php but they arent, xx1. works fine

    are you jeremyfifty on gtalk/

  4. #4
    Join Date
    Jan 2008
    Posts
    4,167
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    [offtopic]Yes, I am...[/offtopic]
    Jeremy | jfein.net

  5. #5
    Join Date
    Mar 2008
    Posts
    58
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Default

    im guessing you dont know?

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
  •