You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 79 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - TWL Block needed for displaying 2 teams [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
DZaster
Nuke Soldier
Nuke Soldier


Joined: Mar 05, 2004
Posts: 10

Location: Ohio

PostPosted: Sun Mar 27, 2005 3:32 pm Reply with quoteBack to top

I really like this block, but our clan has two teams and if I try and add two separate blocks on the main page, the 2nd one doesn't display and makes the whole site mess up. Any help on coding this same block so it will function the same, but the original block won't conflict? Please help! Thanks!

Code:
<?php


if (eregi("block-TWL_Schedule.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}

//This is to keep those annoying parsing errors to ourselves
error_reporting(0);
//added by [STAB]-Ravenstone

//Copy and paste your clan TWL XML URL below.
$file = "http://www.teamwarfare.com/xml/viewteam_v2.asp?team=";
//Comment out this line to test what happens to your script when there is no file available same as if TWL xml stream is down.

class LadderInfo {

   var $ladder;
   var $ladderhtmllink;
   var $ladderxmllink;
   var $rank;
   var $wins;
   var $losses;
   var $forfeits;
   var $status;
   var $opponent;
   var $opponenthtmllink;
   var $opponentxmllink;
   var $date;
   var $maps;
   var $sides;

function LadderInfo() {
   $maps = array();
   $sides = array();
}
}

class LeagueInfo {
   var $league;
   var $leaguehtmllink;
   var $leaguexmllink;
   var $conference;
   var $division;
   var $status;
   var $opponent;
   var $opponenthtmllink;
   var $opponentxmllink;
   var $date;
   var $maps;

function LeagueInfo() {
   $maps = array();
}
}

class Team {
   var $name;
   var $url;
   var $email;
   var $founder;
   var $description;
   var $ircserver;
   var $channel;
   var $status;
   var $ladderinfo;
   var $leagueinfo;

function Team() {
   $this->ladderinfo = array();
   $this->leagueinfo = array();
}
}

   $team = new Team();

function formatDate($datetime) {
   $splitDate = split(" ", $datetime);
      array_splice($splitDate, 3, 0, date("Y"));

if (count($splitDate) > 0) {
$datetime = $splitdate[0];

for ($j = 0; $j < count($splitDate); $j++) {
$datetime = $datetime." ".$splitDate[$j];
}

$timestamp = (int)strtotime($datetime);
putenv("TZ=EST5EDT");
$datetime = strftime("%D %r %Z", $timestamp);
}

return $datetime;
}

function formatDate1($datetime) {
$timestamp = (int)strtotime($datetime);
putenv("TZ=EST5EDT");
$datetime = strftime("%A, %B %d", $timestamp);

return $datetime;
}

function xml_get_children($vals, &$i) {
$children = array();
if (isset($vals[$i]['value'])) $children[] = $vals[$i]['value'];

while (++$i < count($vals)) {
switch ($vals[$i]['type']) {
case 'cdata':
$children[] = $vals[$i]['value'];
break;

case 'complete':
$children[] = array(
'tag' => $vals[$i]['tag'],
'attributes' => isset($vals[$i]['attributes'])? $vals[$i]['attributes'] : null,
'value' => $vals[$i]['value'],
);
break;

case 'open':
$children[] = array(
'tag' => $vals[$i]['tag'],
'attributes' => isset($vals[$i]['attributes'])? $vals[$i]['attributes'] : null,
'children' => xml_get_children($vals, $i),
);
break;

case 'close':
return $children;
}
}
}

function xml_get_tree($file) {
$data = join('', file($file));

$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $vals, $index);
xml_parser_free($parser);

return array(
'tag' => $vals[0]['tag'],
'attributes' => isset($vals[0]['attributes'])? $vals[0]['attributes'] : null,
'children' => xml_get_children($vals, $i = 0),
);
}

$tree = xml_get_tree($file);

foreach ($tree['children'] as $children) {
if ($children['tag'] == "teaminformation") {
$team->name = $tree['children'][0]['children'][0]['value'];
$team->url = $tree['children'][0]['children'][1]['value'];
$team->email = $tree['children'][0]['children'][2]['value'];
$team->founder = $tree['children'][0]['children'][5]['value'];
$team->description = $tree['children'][0]['children'][6]['value'];
$team->ircserver = $tree['children'][0]['children'][3]['value'];
$team->channel = $tree['children'][0]['children'][3]['attributes']['channel'];
$team->status = $tree['children'][0]['children'][4]['value'];
} else if ($children['tag'] == "competitioninformation") {
if (array_key_exists("children", $children)) {
foreach ($children['children'] as $comp) {
if ($comp['tag'] == "ladder") {
$lil = count($team->ladderinfo);
$team->ladderinfo[$lil] = new LadderInfo();
$team->ladderinfo[$lil]->ladder = $comp['attributes']['name'];
$team->ladderinfo[$lil]->ladderhttplink = $comp['children'][0]['children'][0]['value'];
$team->ladderinfo[$lil]->ladderxmllink = $comp['children'][0]['children'][1]['value'];
$team->ladderinfo[$lil]->rank = $comp['children'][1]['value'];
$team->ladderinfo[$lil]->wins = $comp['children'][2]['value'];
$team->ladderinfo[$lil]->losses = $comp['children'][3]['value'];
$team->ladderinfo[$lil]->forfeits = $comp['children'][4]['value'];
$team->ladderinfo[$lil]->status = $comp['children'][5]['attributes']['status'];

if (array_key_exists("children", $comp['children'][5])) {
$team->ladderinfo[$lil]->opponent = $comp['children'][5]['children'][0]['value'];
$team->ladderinfo[$lil]->opponenthtmllink = $comp['children'][5]['children'][1]['children'][0]['value'];
$team->ladderinfo[$lil]->opponentxmllink = $comp['children'][5]['children'][1]['children'][1]['value'];
$team->ladderinfo[$lil]->date = $comp['children'][5]['children'][2]['value'];
$team->ladderinfo[$lil]->maps[0] = $comp['children'][5]['children'][3]['attributes']['name'];
if (array_key_exists("children", $comp['children'][5]['children'][3])) $team->ladderinfo[$lil]->sides[0] = $comp['children'][5]['children'][3]['children'][0]['children'][0]['value'];
$team->ladderinfo[$lil]->maps[1] = $comp['children'][5]['children'][4]['attributes']['name'];
$team->ladderinfo[$lil]->maps[2] = $comp['children'][5]['children'][5]['attributes']['name'];
}
} else if ($comp['tag'] == "league") {
$lil = count($team->leagueinfo);
$team->leagueinfo[$lil] = new LeagueInfo();
$team->leagueinfo[$lil]->league = $comp['attributes']['name'];
$team->leagueinfo[$lil]->leaguehttplink = $comp['children'][0]['children'][0]['value'];
$team->leagueinfo[$lil]->leaguexmllink = $comp['children'][0]['children'][1]['value'];
$team->leagueinfo[$lil]->conference = $comp['children'][1]['value'];
$team->leagueinfo[$lil]->division = $comp['children'][2]['value'];
$team->leagueinfo[$lil]->status = $comp['children'][3]['children'][0]['attributes']['status'];

if (array_key_exists("children", $comp['children'][3])) {
$team->leagueinfo[$lil]->opponent = $comp['children'][3]['children'][0]['children'][0]['value'];
$team->leagueinfo[$lil]->opponenthtmllink = $comp['children'][3]['children'][0]['children'][1]['children'][0]['value'];
$team->leagueinfo[$lil]->opponentxmllink = $comp['children'][3]['children'][0]['children'][1]['children'][1]['value'];
$team->leagueinfo[$lil]->date = formatDate1($comp['children'][3]['children'][0]['children'][3]['value'])." 9:30 PM EST";
$team->leagueinfo[$lil]->maps[0] = $comp['children'][3]['children'][0]['children'][2]['attributes']['name'];
$team->leagueinfo[$lil]->maps[1] = $comp['children'][3]['children'][0]['children'][3]['attributes']['name'];
$team->leagueinfo[$lil]->maps[2] = $comp['children'][3]['children'][0]['children'][4]['attributes']['name'];
}
}
}
}
}
}




$html = "
<table bgcolor=\"".$bgcolor1."\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">
<td align=\"center\" colspan=\"5\"><font color=\"red\" size=\"5\"><u>LADDERS </u></font color>&nbsp;</td>
<tr>
<td align=\"middle\" colspan=\"5\">
</td>
</tr>";



for ($i = 0; $i < count($team->ladderinfo); $i++) {
$html .= "
<table bgcolor=\"".$bgcolor1."\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">

<tr>
<td align=\"middle\" colspan=\"1\"><h4><b><u><font color=grey><a href=\"".$team->ladderinfo[$i]->ladderhttplink."\">".$team->ladderinfo[$i]->ladder."</font color></b></u></h4></a></td></tr>
<td align=\"middle\" colspan=\"1\">Current Rung: <b><font color=blue>".$team->ladderinfo[$i]->rank."</font color></b> </tr>
<tr>
</td></tr>
";

if (isset($team->ladderinfo[$i]->opponent)) {
$html .= "
<table bgcolor=\"".$bgcolor1."\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\" border=\"0\" colspan=\"1\">
<td align=\"middle\" colspan=\"1\" width=\"25%\"><u>Date</u></td>
<td align=\"middle\" colspan=\"1\" width=\"15%\"><u>Current Status</u></td>
<td align=\"middle\" colspan=\"1\" width=\"15%\"><u>Side</u></td>
<td align=\"middle\" colspan=\"1\" width=\"20%\"><u>Opponent</u></td>
<td align=\"middle\" colspan=\"1\" width=\"20%\"><u>Map</u></td></tr>
<tr>
<td align=\"middle\" colspan=\"1\" width=\"25%\">".$team->ladderinfo[$i]->date."</td>
<td align=\"middle\" colspan=\"1\" width=\"15%\">".$team->ladderinfo[$i]->status."</td>
<td align=\"middle\" colspan=\"1\" width=\"15%\">".$team->ladderinfo[$i]->sides[0]."</td>
<td align=\"middle\" colspan=\"1\" width=\"20%\"><a href=\"".$team->ladderinfo[$i]->opponenthtmllink."\">".$team->ladderinfo[$i]->opponent."</a> </td>
<td align=\"middle\" colspan=\"1\" width=\"20%\">".$team->ladderinfo[$i]->maps[0]."</td>
</tr></td>
";
} else {
$html .= "
<tr>
<td align=\"center\" colspan=\"1\">
No Match Scheduled
</td>
</tr>";
}
$html .= "
<tr>
<td align=\"center\" colspan=\"1\">&nbsp;</td>
</tr>
";
}
for ($i = 0; $i < count($team->leagueinfo); $i++) {
$html .= "
<table bgcolor=\"".$bgcolor1."\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\" border=\"0\" colspan=\"3\">
<td align=\"center\" colspan=\"5\"><font color=red><h3><u>Leagues</u></h3></font color=red>&nbsp;</td>
<tr>
<td align=\"middle\" colspan=\"5\"><b><u><h4><a href=\"".$team->leagueinfo[$i]->leaguehttplink."\">".$team->leagueinfo[$i]->league."</h4></b></u></a></td>
</tr>
<tr>
<td align=\"middle\" colspan=\"5\">Conference: ".$team->leagueinfo[$i]->conference."</tr></td>
<tr>
<td align=\"middle\" colspan=\"5\">Division: ".$team->leagueinfo[$i]->division."</td>
<tr>
<td align=\"middle\" colspan=\"1\" width=\"25%\"><u>Date</u>
<td align=\"middle\" colspan=\"1\" width=\"15%\"><u>Current Status</u>
<td align=\"middle\" colspan=\"1\" width=\"15%\"><u>x</u>
<td align=\"middle\" colspan=\"1\" width=\"20%\"><u>Opponent</u>
<td align=\"middle\" colspan=\"1\" width=\"20%\"><u>Map</u>
</tr>
<tr>
<td align=\"middle\" colspan=\"1\" width=\"20%\">".$team->leagueinfo[$i]->date."
<td align=\"middle\" colspan=\"1\" width=\"15%\">".$team->leagueinfo[$i]->status."
<td align=\"middle\" colspan=\"1\" width=\"15%\">
<td align=\"middle\" colspan=\"1\" width=\"20%\"><a href=\"".$team->leagueinfo[$i]->opponenthtmllink."\">".$team->leagueinfo[$i]->opponent."</a>
<td align=\"middle\" colspan=\"1\" width=\"20%\">".$team->leagueinfo[$i]->maps[0]."</td>
</tr>

</td>
</tr>
";

if (isset($team->leagueinfo[$i]->opponent)) {
$html .= "
<tr>
<tr>
</td>
</tr>
<tr>
<td align=\"middle\" colspan=\"3\">
</tr>
";
} else {
$html .= "
<tr>
<td align=\"center\" colspan=\"3\">
No Match Scheduled
</td>
</tr>";
}
$html .= "
<tr>
<td align=\"center\" colspan=\"3\">
</td>
<tr>";

}


$html .= "</table>";

//Added by [STAB]-Ravenstone to switch between normal scrolling Ladder information and unavailable when not there...

if($team->name == NULL)
{
   $content .="</Marquee><table bgcolor=\"".$bgcolor1."\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\" border=\"0\" colspan=\"3\">
   <td align=\"center\" colspan=\"5\">TWL Service Currently Unavailable.</tr></table>";
}
else
{
$content = "<Marquee Behavior=\"Scroll\" Direction=\"Up\" Height=\"110\" ScrollAmount=\"2\" ScrollDelay=\"50\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
$content .= $html;
$content .= "</Marquee><br>";
}
 
//Added by [STAB]-Ravenstone to switch between normal scrolling Ladder information and unavailable when not there...

$content .="
<table bgcolor=\"".$bgcolor1."\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\" border=\"0\" colspan=\"3\">
<tr>
<td align=\"middle\" colspan=\"5\" width=\"100%\">__________________________________________</tr></td><tr>
<td align=\"middle\" colspan=\"5\" width=\"100%\">Click to view</tr>
<tr>


<td align=\"middle\" colspan=\"5\" width=\"100%\"><font color=blue><h4>--><A HREF='http://xxxxxxxxxx</a><--</h4></td>
</table>"; //Change the address in this link above to point to your Clan's normal page on TWL's website
$content .="";


?>
Find all posts by DZasterView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.215 Seconds - 135 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::