Skip to content

Instantly share code, notes, and snippets.

@lazypower
Created April 12, 2011 06:53
Show Gist options
  • Save lazypower/915067 to your computer and use it in GitHub Desktop.
Save lazypower/915067 to your computer and use it in GitHub Desktop.
<?PHP
$lastfm = new LastFm();
$albums = $lastfm->user_getRecentTracks("user=lazypower");
//$shouts = $lastfm->user_getShouts("user=lazypower");
$info = $lastfm->user_getInfo("user=lazypower");
?>
// display user info
<?php foreach ($info as $w) : ?>
<!-- <div class="contentContainer">
<p /> <h1> <a href=" <?PHP echo $w[user][url][value]; ?>"> <?PHP echo $w[user][name][value]; ?>
<img src=" <?PHP echo $w[user][image][1][value]; ?> /></a>
*/ -->
<span class="lfm-heading">Total Songs Scrobbled: <?PHP echo $w["user"]["playcount"]["value"]; ?></span><p />
<!-- </div> -->
<?PHP endforeach; ?>
<span class="lfm-heading">Recently Played</span>
<?PHP //if ($albums[1][recenttracks][track][1][attr][nowplaying] == true) { do stuff } ?>
<div class="LFMContainer">
<?PHP
forEach ($albums as $v) :
for ($i = 0; $i <= 8; $i++) :
if ($i == 0 | $i == 3 | $i == 6 ) {
echo("<ul class=\"lfm-thumb\">");
echo("<li class=\"lfm-leftborder\">");
} else {
echo("<li>");
}
?>
<a rel="tooltip" title="
<br />Title: <?php echo $v["recenttracks"]["track"][$i]["name"]["value"]; ?>
<br />Artist: <?php echo $v["recenttracks"]["track"][$i]["artist"]["value"]; ?>
<br />Album: <?php echo $v["recenttracks"]["track"][$i]["album"]["value"]; ?> "/>
<img src="
<?php if ($v["recenttracks"]["track"][$i]["image"][3]["value"] != null){
echo $v["recenttracks"]["track"][$i]["image"][3]["value"] . "\"/>";
} else {
echo("include/noimage.jpg \"/>");
} ?> </a></li>
<?php if ($i == 2| $i == 5 | $i == 8 ) : ?>
</ul>
<?PHP endif; ?>
<?php endfor; ?>
<?php endforeach; ?>
</div>
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment