For those who have a steam group, you can easily display your steamgroup stats on your frontpage. I included 2 versions a cached version (which I recommend to use but takes a tiny bit more effort to run) and a non-cached version which runs out of the box (might slow down your site a bit more).
Instructions Cached Version:
1.Navigate to AdminCP -> CMS -> Widgets.
2. Create a PHP Type Widget and paste the code from below:
cached version:
PHP Code:
<html>
<style type="text/css">
span.membersInGame {
font-size: 11px;
color: #8bc53f;
font-family:arial, Helvetica, tahoma, sans-serif;
text-decoration:none;
}
span.membersOnline {
font-size: 11px;
color: #62a7e3;
font-family:arial, Helvetica, tahoma, sans-serif;
text-decoration:none;
}
</style>
</html>
<?php
$group = freefragnet;
$cachefile = 'cache/grpcache.html';
$cachetime = 5 * 60; // 5 minutes
if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile))) {
include($cachefile);
echo "<!-- Cached ".date('jS F Y H:i', filemtime($cachefile))." -->";
} else {
ob_start();
$url = file_get_contents('http://steamcommunity.com/groups/'.$group);
ini_set('default_socket_timeout', 0);
preg_match('#<h1>(.+)</h1>#sU', $url, $aMatches);
echo "<div class=blockrow>";
echo "<table>";
echo "<a class='clanname' href='http://steamcommunity.com/groups/$group' target='_blank'>$aMatches[1]</a>";
echo "<br>";
preg_match('#<div class="groupMemberRow">(.+)</div>#sU', $url, $aMatches);
$aMatches = str_replace('class="linkStandard"', 'class="linkStandard" target="_blank"', $aMatches[1]);
$pieces = explode(" ", $aMatches);
$domain = strstr($pieces[3], '>');
$strip1 = substr($domain, 1);
echo "<span class=resultsb>$strip1 Members</span>";
echo "<br>";
$domain1 = strstr($pieces[6], '>');
$strip2 = substr($domain1, 1);
echo "<span class=membersInGame><font color=#8bc53f>$strip2 In-Game</font></span>";
echo "<br>";
$domain2 = strstr($pieces[9], '>');
$strip3 = substr($domain2, 1);
echo "<span class=membersOnline><font color=#62a7e3>$strip3 Online</font></span>";
echo "</table>";
echo "</div>";
$fp = fopen($cachefile, 'w');
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_flush();
ob_end_clean();
}
?>
3. Edit $group = freefragnet; to your group. This is in the url base for your steam group Example: http://steamcommunity.com/groups/freefragnet
4. In your ftp, in the same base folder vbulletin is hosted, create a folder named 'cache' and CHMOD to 777.
5. Your set
Demo: http://www.freefrag.com/
Instructions Non-Cached Version:
1.Navigate to AdminCP -> CMS -> Widgets.
2. Create a PHP Type Widget and paste the code from below:
non-cache
PHP Code:
<html>
<style type="text/css">
span.membersInGame {
font-size: 11px;
color: #8bc53f;
font-family:arial, Helvetica, tahoma, sans-serif;
text-decoration:none;
}
span.membersOnline {
font-size: 11px;
color: #62a7e3;
font-family:arial, Helvetica, tahoma, sans-serif;
text-decoration:none;
}
</style>
</html>
<?php
$group = freefragnet;
$url = file_get_contents('http://steamcommunity.com/groups/'.$group);
ini_set('default_socket_timeout', 0);
preg_match('#<h1>(.+)</h1>#sU', $url, $aMatches);
echo "<div class=blockrow>";
echo "<table>";
echo "<a class='clanname' href='http://steamcommunity.com/groups/$group' target='_blank'>$aMatches[1]</a>";
echo "<br>";
preg_match('#<div class="groupMemberRow">(.+)</div>#sU', $url, $aMatches);
$aMatches = str_replace('class="linkStandard"', 'class="linkStandard" target="_blank"', $aMatches[1]);
$pieces = explode(" ", $aMatches);
$domain = strstr($pieces[3], '>');
$strip1 = substr($domain, 1);
echo "<span class=resultsb>$strip1 Members</span>";
echo "<br>";
$domain1 = strstr($pieces[6], '>');
$strip2 = substr($domain1, 1);
echo "<span class=membersInGame><font color=#8bc53f>$strip2 In-Game</font></span>";
echo "<br>";
$domain2 = strstr($pieces[9], '>');
$strip3 = substr($domain2, 1);
echo "<span class=membersOnline><font color=#62a7e3>$strip3 Online</font></span>";
echo "</table>";
echo "</div>";
?>
3. Edit $group = freefragnet; to your group. This is in the url base for your steam group Example: http://steamcommunity.com/groups/freefragnet
4. Your set
Demo: http://www.freefrag.com/