wee493 Posted June 11, 2010 Share Posted June 11, 2010 I'm creating a stat-type page for last.fm. Using a foreach loop I'm returning the data from the last.fm api. I'm linking artist names to the appropriate artist page and so on with songs & albums. The only problem is that in two of the three loops only the links from the first result are working. The <a hef is displayed when viewing the html source, I'm stumped. You can see for yourself here... http://wee493.com/lastfm/?user=josho493 (Feel free to plugin your own last.fm username here if you would like ) Here's one of the loops that is having the problem. <?PHP $top_tracks = $lastfm->user_getTopTracks("user=".$user); foreach ($top_tracks['lfm']['toptracks']['track'] as $trk){ $rank = $trk['attr']['rank']; $name = $trk['name']['value']; $playcount = $trk['playcount']['value']; $url = $trk['url']['value']; $artist = $trk['artist']['name']['value']; $artist_link = $trk['artist']['url']['value']; if($rank <= '10'){ ?> <div class="top"> <div class="rank"> <?PHP echo $rank; ?> </div> <div class="top-song-info"> <div class="title"> <a href="<?PHP echo $url; ?>" target="_blank"><?PHP echo $name; ?></a> </div> <div class="artist-info"> <span class="artist"><a href="<?PHP echo $artist_link; ?>" target="_blank"><?PHP echo $artist; ?></a></span> <span class="date"><?PHP echo $playcount; ?> Plays</span> </div> </div> </div> <?PHP } /* end if */ } // end foreach Any help is appreciated! Thanks Link to comment https://forums.phpfreaks.com/topic/204466-problem-with-links-in-a-loop/ Share on other sites More sharing options...
JasonLewis Posted June 11, 2010 Share Posted June 11, 2010 Um, use Firebug. If you check in Firebug, there is a big div called "center-vertical" which is positioning itself over most of your stuff. I'd sort that out. Regards Link to comment https://forums.phpfreaks.com/topic/204466-problem-with-links-in-a-loop/#findComment-1070788 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.