>>  Site Map >>  Forums >>  Not Enough Info

Forum module - topics in forum:



Not Enough Info - If you didn't supply Version #, Version of Nuke, Url of your Site, etc, your post goes here until you do.



XML feed

I'm tryting to find a code for an xml feed that i have

the code right now is:
$xmllink="http://aaotracker.4players.de/livefeed/xml_clanprofile.php?clanid=$clanid";

where clanid=46300

what I'm trying to do is have it check 2 links, everthing is the same except the clan ID

$clanid1="46300";
$clanid2="57174";



the whole coding for the block I have is as follows:

Code: :

<?php
if (eregi("block-AAO_Stats.php", $_SERVER['PHP_SELF'])) {
   Header("Location: index.php");
   die();
}

global $user, $cookie, $prefix, $db, $user_prefix, $stack;

// Replace with your Clan Tracker ID
$clanid="46300";




// Parse XML

$stack = array();
$claninfo = array();
$clanstats = array();
$playerstats = array();

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "cdata");

$xmllink="http://aaotracker.4players.de/livefeed/xml_clanprofile.php?clanid=$clanid";
$data = xml_parse($xml_parser,file_get_contents($xmllink));
if(!$data) die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));


xml_parser_free($xml_parser);


// Get Data

 // Get Clan Profile Data
 for($i = 0; $i < sizeof($stack[0][children][0][children]); $i++) {
  $valname=$stack[0][children][0][children][$i][name];
  $claninfo[$valname]=$stack[0][children][0][children][$i][cdata];
 }

 // Get Clan Stats Data
 for($i = 0; $i < sizeof($stack[0][children][1][children]); $i++) {
  $valname=$stack[0][children][1][children][$i][name];
  $clanstats[$valname]=$stack[0][children][1][children][$i][cdata];
 }

 // Get Player Data
 for($i = 0; $i < sizeof($stack[0][children][2][children]); $i++) {
  for($x = 0; $x < sizeof($stack[0][children][2][children][$i][children]); $x++) {
   $valname=$stack[0][children][2][children][$i][children][$x][name];
   $value=$stack[0][children][2][children][$i][children][$x][cdata];
   if($valname=="PLAYERID") $pid=$value;
   $playerstats[$pid][$valname]=$value;
  }
 }
 
// Now we have 3 arrays with all stats and infos. Prints all data the XML receives.
// print_r($claninfo);
//print_r($clanstats);
// print_r($playerstats);

//// CODE ADDED BY TRU (www.orcclan.us) or Contact VIA MSN at KenDog123@hotmail.com
//// Starts the table without interfering in the duplication process ////with the Parsed XML Data.
$content .= "<table align=\"center\" width=\"97%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\">
<tr><td></td></tr>";
//// CODE ADDITION ENDED

foreach($playerstats as $key => $value) {
 $playername=$playerstats[$key][PLAYERNAME];
 ///$playerhonor=$playerstats[$key][PLAYERHONOR];
 $playerurl=$playerstats[$key][PLAYERSTATSURL];
 // CODE ADDED BY TRU (www.orcclan.us) or Contact VIA MSN at KenDog123@hotmail.com
 ///$playerkills=$playerstats[$key][PLAYERKILLS];
 ///$playerkia=$playerstats[$key][PLAYERDEATHS];
 $playerroe=$playerstats[$key][PLAYERROE];
 

 // Player's Fragrate is determined by PLAYERKILLS divided by PLAYERDEATHS.

 if($playerstats[$key][PLAYERSTATUS]=="1") $statuspic="ponline.gif";
 else $statuspic="poffline.gif";
 
 //if (round(($playerkills/$playerkia),2) < 1) {
 //$font = "#FF0000"; }
 //elseif (round(($playerkills/$playerkia),2) > 2) {
 //$font = "#009900";
 //}
 //else {
 //$font = "#FFCC00";
 //}
 
// $frpercent = (round(($playerkills/$playerkia),2) * 100) - 100;

// Displays the Parsed XML Data. You can edit if you know what you are doing.
$content .= "<tr><td><font color=\"#FFFFCC\"><a target=\"_blank\"
href=\"$playerurl\">$playername</a></font></td><td><img border=\"0\" src=\"./images/$statuspic\" </td></tr>";

}

// Closes the table.
$content .= "</table>";
// CODE ADDITION ENDED
?>









from looking at the code on the block what you are asking isn't possible, not without rewriting the entire block.

Perhaps you could just run 2 of the same block, just name one of them block-AAO_Stats_2.php worst case is it doesn't work.






alright thanks. I already have 2 separate blocks right now, I was just wanting to see if it was possible to combine them.




Attention! You are currently viewing sitemap page!
We strongly suggest to look at original content

Search from web

Valid HTML 4.01 Valid CSS