Hi all!
I thank the author for this great addition (stats)!
If you want players steamcommunity avatars, ranking etc. on your own stats web site like this:
player php sample
find in player.php this:
PHP Code:
if (mysql_num_rows($result) > 0)
{
$playername = htmlentities($row['name'], ENT_COMPAT, "UTF-8");
$timesrow = mysql_fetch_array(mysql_query("SELECT COUNT(*) AS times FROM " . $mysql_tableprefix . "timedmaps WHERE steamid = '" . $id . "'"));
$times = $timesrow['times'];
and just after put this code:
PHP Code:
$xml = simplexml_load_file('http://steamcommunity.com/profiles/'.getfriendid($row['steamid']).'?xml=1');
foreach ($xml->avatarMedium as $foo)
{
$Avatar = "<img src=".$foo."> ";
}
foreach ($xml->steamRating as $foo)
{
$SRank = "</br><small><small><b>Steam Rating:</b> $foo </small></small>";
}
$xml = simplexml_load_file('http://steamcommunity.com/profiles/'.getfriendid($row['steamid']).'/stats/L4D2/?xml=1');
foreach ($xml->stats->lifetime as $foo)
{
$TTima = " <small><small><b>Total time played:</b> $foo->timeplayed</small></small>";
}
foreach ($xml->stats->lifetime as $foo)
{
$PHour = " <small><small><b>Kills per hour:</b> $foo->killsperhour</small></small>";
}
then replace lines:
PHP Code:
$tpl->set("title", "Viewing Player: " . $playername); // Window title
$tpl->set("page_heading", "Viewing Player: " . $playername); // Page header
with this:
PHP Code:
$tpl->set("title", "Viewing Player: " . $playername); // Window title
$tpl->set("page_heading", "" . $Avatar . $playername . $SRank . $TTima . $PHour); // Page header
Enjoy!
__________________