Jump to content

brackets help with border


karimali831

Recommended Posts

Hi all,

 

I am having trouble setting the style border for the right columns, if you are take a look here:-

http://teamx1.com/popup.php?site=test&action=brackets you can see what I mean.

 

First and second from last column looks okay but the other columns the border line are all over the place, they should

only be in between and next to the blue boxes only where it says "Game .." exactly how the first column and "Finals" columns are.

 

I have defined it in $borderline variable.

 

Full code:

<?php

if(isset($_GET['action'])) $action = $_GET['action'];
else $action='';

$tourney[id] = 11;
$tinfo=safe_query("SELECT * FROM tourneys WHERE tid='$tourney[id]'");
$tinfo=mysql_fetch_array($tinfo);

switch($action){
    case "brackets":
    tourney_brackets();
    break;
}

function table_head($type,$width,$height,$align){
global $url;

if($type=="show"){

$tablehead="
<table width='$width' height='$height' cellspacing='$cellspacing' cellpadding='$cellpadding' bgcolor='$border'>
<tr>
<td width='10' height='10' valign='top' align='left'>
<img src='$url[curtheme]/images/mid_menu_ltcorner.gif'></td>
<td width='100%' height='10' valign='top' align='left' background='$url[curtheme]/images/mid_menu_tbg.gif'></td>
<td width='10' height='10' valign='top' align='right'>
<img src='$url[curtheme]/images/mid_menu_rtcorner.gif'></td>
</tr>
<tr>
<td width='10' height='100%' valign='top' align='left' background='$url[curtheme]/images/mid_menu_lbg.gif'></td>
<td width='100%' height='100%' valign='top' align='$align'>";

}
return($tablehead);
}

function table_foot($type){
global $url;

if($type=="show"){

$tablefoot="
</td>
<td width='10' height='100%' valign='top' align='right' background='$url[curtheme]/images/mid_menu_rbg.gif'></td>
</tr>
<tr>
<td width='10' height='10' valign='top' align='left'>
<img src='$url[curtheme]/images/mid_menu_lbcorner.gif'></td>
<td width='100%' height='10' valign='top' align='left' background='$url[curtheme]/images/mid_menu_bbg.gif'></td>
<td width='10' height='10' valign='top' align='right'>
<img src='$url[curtheme]/images/mid_menu_rbcorner.gif'></td>
</tr>
</table>";

}
return($tablefoot);
}


function tourney_brackets(){
    global $tinfo, $url, $out, $plyr, $site, $uinfo, $misc, $file;
    $brackets=safe_query("SELECT bid,pid,name FROM brackets2 WHERE tid='$tinfo[tid]' ORDER BY bid");
    while(list($bid,$pid,$name)=mysql_fetch_row($brackets)){
        if($pid){
            $bracket[$bid]="<font type='arial' size='2'><a href='$url[base]/$file[teams]?teamid=$pid'>$name</a></font>";
        }else{

            $bracket[$bid]="$name";
        }

        $pid="";
    }

    $brackets="$tinfo[size]";
    $spots=($brackets * 2 - 1);
    $temp_rows="$brackets";
    while($temp_rows > 1){
        $rowcount++;
        if($rowcount > 1){
            $temp_rows=($temp_rows / 2);
        }

        $listrows.="-> $temp_rows";
        $rows="$rowcount";
    }

    $rowwidths=round(100 / $rows - 0.5);
    $actualrows=($rows * 2);
    ////////////////////////////////
    $tablehead=table_head("show","100%","","left");
    $tablefoot=table_foot("show");
    $bannerhead=table_head("show","488","80","center");
    $bannerfoot=table_foot("show");
    $out[body]=$out[body]."
    <center>
    $bannerhead
    $out[banner]
    $bannerfoot  <br>
    $tablehead    <strong>
    <table width='100%' cellspacing='$cellspacing' cellpadding='$cellpadding' bgcolor='$border'>
    <tr class ='altcolor'>
    <td width='100%' valign='top' align='center'>
    <b>$tinfo[name] Brackets</b><br>
    </td></tr></table>
    <br><br>
    <table width='100%' cellspacing='$cellspacing' cellpadding='$cellpadding' bgcolor='$border'>
    <tr>
    ";
    $counter="$brackets";

    while($counter > 1){

        if($round){
            $counter=($counter / 2);
        }

        $lastcb="$countbrackets";
        $countbrackets="";
        $game="";
        $round++;
        $finals=($rows - 1);
        $winner=($rows);
        $roundgamesay="Round $round Games";
        if($round=="$winner"){
            $roundgamesay="Winner!";
        }

        if($round=="$finals"){
            $roundgamesay="Finals";
        }

        $out[body]=$out[body]."
        <td align='center' valign='center' width='$rowwidths%' colspan='2'><b>$roundgamesay</b><br>
        <table width='100%' cellspacing='$cellspacing' cellpadding='$cellpadding' bgcolor='$border'>
        ";
        $spacesetcount="";

        while($countbrackets < $counter){
            $countbrackets++;
            $spot++;
            $spacesetcount++;
            if($spacesetcount=="4"){
                $spacesetcount="";
            }

            $bracketid="$round"."_"."$countbrackets";
            $out[body]=$out[body]."
            <tr>
            <td align='left' valign='center' width='100%' bgcolor='#e4f3ff'>$bracket[$bracketid]</td>
            <td align='left' style='border-right:2px solid #333333;' bgcolor='#D9D9D9' valign='center' width='100%'> </td>
            </tr>
            ";
            if($countbrackets < $counter){
                $spacecounter++;
                $spacecounter=($spacecounter + 1);
                if($spacecounter==2){
                    $roundx2p1=($lastroundx2p1 * 2 + 1);
                    if($round==1){
                        $roundx2p1="1";
                    }

                    while($countspaces < $roundx2p1){
                        $countspaces++;      
                        $spacecentercount++;
                        $spacecenterword="";
                        $alignspacer1="left";
                        $spacecentercountcheck=($lastroundx2p1 + 1);
                        if($spacecentercount=="$spacecentercountcheck"){
                            $spacecenterwordcount++;
                            if(($spacecenterwordcount==1)||($spacecenterwordcount==3)){
                                $actualgamecount++;
                                $spacecenterword="<b>Game $actualgamecount</b>";
                                $alignspacer1="center";

							if(!empty($spacecenterword))								
							$borderline = "style='border-right:2px solid #333333;'";

                                if($spacecenterwordcount==3){
                                    $spacecenterwordcount="";
                                    $spacecenterwordcount++;
                                }

                            }
						else
							$borderline = "";

                        }

                        $out[body]=$out[body]."
                        <tr>
                        <td align='$alignspacer1' valign='center'>  $spacecenterword</td>
                        <td align='left' valign='center' ".$borderline."> </td>
                        </tr>
                        ";
                    }

                    $spacecounter="";
                    $countspaces="";
                    $spacecentercount="";
                }

            }

        }

        $spacecenterwordcount="";
        $actualgamecount="";
        $lastroundx2p1="$roundx2p1";
        $out[body]=$out[body]."
        </table>
        </td>
        ";
    }

    $out[body]=$out[body]."
    </tr>
    </table><br><br>
    <table width='100%' cellspacing='$cellspacing' cellpadding='$cellpadding' bgcolor='$border'>
    <tr class ='altcolor'>
    <td width='100%' valign='top' align='center'>
    <br>
    </td></tr></table>
    <br>
    $tablefoot";

echo $out[body];

}
?>

 

Any help on this would be great, thanks to anyone.  :)

Link to comment
https://forums.phpfreaks.com/topic/265201-brackets-help-with-border/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.