danielsreichenbach / phparmory

A PEAR compliant PHP library for accessing the World of Warcraft armory.
http://wowarmory.com/
GNU General Public License v3.0
3 stars 0 forks source link

guildData wont work #1

Open chanpa opened 14 years ago

chanpa commented 14 years ago

Hi, I have a small problem with the guildData array. I am using the example file and it ain't showing basically anything. It shows: Roster

Members

Guild Members Name Level Race Class Gender Rank Portrait

As you see the <?=$guildMemberCount;?> Members doesn't show the count, however I fixed this by changing it to: <?php echo $guildMemberCount . " Members"; ?> and now it shows 148 Members where it is supposed to. However doing the same thing to $guildName doesn't work, it is still blank. If I do it to $guildCharacters it just says "Array" on the site. In the foreach($guildCharacters as $char) loop nothing shows except for broken images (I guess 148 of them since the count seems to be right) and the line Data scraped from the official World of Warcraft Armory (armory;?>) (also, I would guess, 148 times) It is like this: [broken image] Data scraped from the official World of Warcraft Armory (armory;?>) [broken image] Data scraped from the official World of Warcraft Armory (armory;?>) [broken image] Data scraped from the official World of Warcraft Armory (armory;?>) etc

which is weird since the Data scraped from the official World of Warcraft Armory (armory;?>) line is outside the foreach loop in the document.

So basically I'm guessing it searches and gets all the data but then it's screwing up somehow. Help would be immensely appreciated. Feel free to add me on msn since I think it will be easier to fix through there. j_alpne88@hotmail.com

chanpa commented 14 years ago

I changed the foreach from: <?php foreach($guildCharacters as $char){ $char = $char; ?>

<?

}

?>

to

<?php

foreach($guildCharacters as $char){ $char = $char;

echo "      <tr>";
echo "      <td>" . $char['name']  ."</td>";
echo "      <td>" . $char['level']  ."</td>";
echo "      <td>" . $char['race']  ."</td>";
echo "      <td>" . $char['class']  ."</td>";
echo "      <td>" . $char['gender']  ."</td>";
echo "      <td>" . $char['rank']  ."</td>";
echo "      <td><img src='".$armory->getCharacterIconURL($char)."'></td>";
echo "      </tr>";

}

?>

and now it shows Names, Level and rank in the table. But the other (race,class and gender) are still blank and the image is still broken.

chanpa commented 14 years ago

I used my head and fixed the image, I checked their location on eu.wowarmory.com and it was _images/ so I checked the link in the phpArmory.class.php file and it did not have an underscore: return $this->armory."images/portraits/$dir/{$characterInfo['genderid']}-{$characterInfo['raceid']}-{$characterInfo['classid']}.gif";

so I just added one after the "_/images/portraits/etcetc and it now works.

Still need to know why race,class and gender are blank. It's really strange since the image is correct... (i.e. human priests have that image and so on) And the guildName still doesn't work either

chanpa commented 14 years ago

I did a ghettofix on the race class gender issue, I changed $char['race'] $char['gender'] $char['class'] to $char['raceid'] $char['genderid'] $char['classid']

and then it printed the respective numbers and then I added if-statements for each like this; $genderid = $char['genderid']; if ($genderid == 1){ $gender = Female; } else { $gender = Male; } and for the more populated class/race; $classid = $char['classid']; if ($classid == 1){ $class = Warrior; }elseif ($classid == 2){ $class = Paladin; }elseif ($classid == 3){ $class = Hunter; }elseif ($classid == 4){ $class = Rogue; }elseif ($classid == 5){ $class = Priest; }elseif ($classid == 6){ $class = Deathknight; }elseif ($classid == 7){ $class = Shaman; }elseif ($classid == 8){ $class = Mage; }elseif ($classid == 9){ $class = Warlock; }elseif ($classid == 11){ $class = Druid; } and then I displayed it echo "

" . $race ."

"; echo "

" . $class ."

"; echo "

" . $gender ."

";

chanpa commented 14 years ago

I found fix for $guildName in the guilddata array aswell; originally it says: $guildName = $guildData['guildinfo']['guild']['name']; but I looked in the raw xml array and found: s:9:"guildinfo";a:2:{ s:11:"guildheader";a:9:{s:11:"battlegroup";s:17:"Rampage / Saccage";s:5:"count";s:3:"122";s:7:"faction";s:1:"0";s:4:"name";s:12:"The Nephilim";s [...] etc wall of text. so I changed it to: $guildName = $guildData['guildinfo']['guildheader']['name']; and now it works. So all my problems are solved. However I can't imagine this is supposed to be how it works or is it? Either way if someone is having same problem as me, read my posts to fix it :)

danielsreichenbach commented 14 years ago

I'll check the current armory XML and update the class accordingly. Thanks for the report. :)