I'm trying to find a formula to find the distance (number of table cells) needed between matches for my tournament brackets. I currently have brackets made for 2 per match and 8 per match, but I would like to combine the two bracket codes to have it calculate space need by how many per match. Say have a tournament with 6 people per match, and have a tournament with 8 people per match all driven by one php code.

http://www.violatedgaming.com/index2.php?option=com_mls_tournaments&task=view_brackets&Itemid=26&tournamentid=26

If you look at round 1&2 you see that round 2 match 1 is halfway between round 1 matches 1&2. This is what I am trying to accomplish for all rounds. Think of it like a tree, the parent node needs to be half way between the two child nodes all the way to the main parent node.

If you can tell me a better way than doing this than in tables it would be much appreciated.

    How about combining the cells with rowspan=x for the higher levels and using valign=center to keep them lined up. Say you have four groups, then the 2nd level has two cells with rowspan=2, then the last level has one cell with rowspan=4. To layout each grouping use a nested table in the cell.

      Thanks for the tip on to valign=center the tables, will definitely use it. Not sure what you where talking about with the rowspans.

        Example -- I'm only doing one level but hopefully you can see what I'm talking about with rowspan:

        <style>
        #a, #a td { border:1px dashed #aaa;border-collapse:collapse;padding:10 }
        #a table, #a table td { border:1px solid black; border-collapse:collapse; padding:5; text-align:center }
        </style>
        <table id='a'>
         <tr>
          <td valign=center>
           <table width=100 border=1>
            <tr>
             <td>row 1</td>
            </tr><tr>
             <td>row 2</td>
            </tr><tr>
             <td>row 3</td>
            </tr>
           </table>
          </td>
          <td [b]rowspan=2[/b]>
           <table width=100 border=1>
            <tr>
             <td>row 1</td>
            </tr><tr>
             <td>row 2</td>
            </tr><tr>
             <td>row 3</td>
            </tr>
           </table>
          </td>
         </tr>
         <tr>
          <td>
           <table width=100 border=1>
            <tr>
             <td>row 1</td>
            </tr><tr>
             <td>row 2</td>
            </tr><tr>
             <td>row 3</td>
            </tr>
           </table>
          </td>
         </tr>
        </table>
          Write a Reply...