karimali831 Posted January 6, 2012 Share Posted January 6, 2012 Hi! I want to be able to create a dynamic tournament bracket but not sure where to get started, right now all the template brackets have been hardcoded, i.e. http://teamx1.com/templates/64.html Can you someone put me in the right direction by using PHP to create and write this file? I want to be able to create 64 + brackets but hardcoding is a huge headache and mistakes easily done. Thanks all. Quote Link to comment https://forums.phpfreaks.com/topic/254495-a-quick-way-for-this/ Share on other sites More sharing options...
AyKay47 Posted January 6, 2012 Share Posted January 6, 2012 using a database is recommended here. Quote Link to comment https://forums.phpfreaks.com/topic/254495-a-quick-way-for-this/#findComment-1304913 Share on other sites More sharing options...
karimali831 Posted January 6, 2012 Author Share Posted January 6, 2012 You lost me? I do use database. Quote Link to comment https://forums.phpfreaks.com/topic/254495-a-quick-way-for-this/#findComment-1304914 Share on other sites More sharing options...
AyKay47 Posted January 6, 2012 Share Posted January 6, 2012 post the relevant code. Quote Link to comment https://forums.phpfreaks.com/topic/254495-a-quick-way-for-this/#findComment-1304922 Share on other sites More sharing options...
karimali831 Posted January 6, 2012 Author Share Posted January 6, 2012 This is an example hard-coded bracket, it is just repetition. Looking to get this created with PHP. I have ideas but not sure how to get it started, I know loops must be used.. if someone has an example or if someone can start me off here I'd appreciate it very much! <div id="turnierbaum_div"> <table align="center" cellpadding="$cellpadding" cellspacing="0" width="100%"> <tr valign="center"> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round1</td> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round2</td> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round_sf_ub</td> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round_gf_ub </td> <td width="100" class="title" align="center" style="font-weight: bold" nowrap="nowrap"> $winner</td> </tr> <tr valign="top"> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map1]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map2]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map3]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map4]</td> <td bgcolor="$c_bg1" style="border-bottom:1px solid $dd[borderbg]; border-right:1px solid $dd[borderbg];"> </td> </tr> <tr> <td colspan="9"></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[1]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[1]</td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[1]</td> <td bgcolor="$c_bg1" align="center">$clan[9]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[5]</td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[2]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[1]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr> <td colspan="2"></td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[5]</td> <td bgcolor="$c_bg1" align="center">$clan[13]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[7]</td> <td colspan="2"></td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[3]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[2]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> </tr> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[2]</td> <td bgcolor="$c_bg1" align="center">$clan[10]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[5]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[4]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[2]</td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> </tr> <tr> <td colspan="2"></td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[7]</td> <td bgcolor="$c_bg1" align="center">$clan[15]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[8]</td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[5]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[3]</td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> </tr> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[3]</td> <td bgcolor="$c_bg1" align="center">$clan[11]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[6]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[6]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[3]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td align="center" style="border-right:2px solid #333333;" colspan="2">$detail[8]</td> <td bgcolor="$c_bg1" align="center">$clan[wb_winner]</td> </tr> <tr> <td colspan="2"></td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[6]</td> <td bgcolor="$c_bg1" align="center">$clan[14] </td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center">$score2[7]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[7]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[4]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> </tr> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[4]</td> <td bgcolor="$c_bg1" align="center">$clan[12]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[6]</td> <td colspan="2"></td> <td bgcolor="$c_bg1" align="center">$clan[16]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center">$score2[8]</td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[8]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[4]</td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"> </td> <td></td> </tr> <tr> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr valign="center"> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round1_lb </td> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round2_lb</td> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round_sf_lb</td> <td width="110" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round_gf_lb</td> <td width="100" class="title" align="center" style="font-weight: bold" nowrap="nowrap" nowrap="nowrap"> $lower_winner</td> </tr> <tr valign="top"> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map5]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map6]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map7]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map8]</td> <td bgcolor="$c_bg1" style="border-bottom:1px solid $dd[borderbg]; border-right:1px solid $dd[borderbg];"> </td> </tr> <tr> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td bgcolor="$c_bg1" align="center">$clan[27]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center">$score1[14]</td> <td></td> <tr> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td colspan="2"></td> <td bgcolor="$c_bg1" align="center">$clan[21]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[11]</td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td colspan="2"></td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[11]</td> <td bgcolor="$c_bg1" align="center">$clan[25]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center">$score1[13]</td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[14]</td> <td bgcolor="$c_bg1" align="center">$clan[lb_winner]</td> <tr> <td bgcolor="$c_bg1" align="center">$clan[17]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[9]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[9]</td> <td bgcolor="$c_bg1" align="center">$clan[22]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[11]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td bgcolor="$c_bg1" align="center">$clan[18]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[9]</td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td colspan="2"></td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[13]</td> <td bgcolor="$c_bg1" align="center">$clan[28]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center">$score2[14]</td> <td></td> <tr> <td bgcolor="$c_bg1" align="center">$clan[19]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[10]</td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[10]</td> <td bgcolor="$c_bg1" align="center">$clan[23]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[12]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> <tr> <td bgcolor="$c_bg1" align="center">$clan[20]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[10]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> <tr> <td colspan="2"></td> <td align="center" style="border-right:2px solid #333333;" colspan="2">$detail[12]</td> <td bgcolor="$c_bg1" align="center">$clan[26]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[13]</td> <td colspan="2"></td> <td></td> <tr> <td colspan="2"></td> <td style="border-right:2px solid #000000;" colspan="2"> </td> <td colspan="2"></td> <td colspan="2"></td> <td></td> <tr> <td colspan="2"></td> <td bgcolor="$c_bg1" align="center">$clan[24]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[12]</td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> </table> </div> Quote Link to comment https://forums.phpfreaks.com/topic/254495-a-quick-way-for-this/#findComment-1304928 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.