Bayler Posted January 18, 2008 Share Posted January 18, 2008 XML url = http://www.xfire.com/xml/sgteversmen/screenshots/ XML Parsed url: http://www.evolutionclans.com/Xfire/ each screenshot is displayed with its associated Game Title.... Im attempting to list the Game Title in a table, then a row of each screenshot associated to that Game Title... If anyone has the ability to help..id sure love to understand HOW i can do this..ill accept any MSN invites and provide any files needed to show how i got this far! baylerfl@msn.com Quote Link to comment https://forums.phpfreaks.com/topic/86691-array-help-request/ Share on other sites More sharing options...
GingerRobot Posted January 18, 2008 Share Posted January 18, 2008 If you're using PHP 5: <?php $xmlstr = file_get_contents('http://www.xfire.com/xml/sgteversmen/screenshots/'); $xml = new SimpleXMLElement($xmlstr); $games = array(); foreach($xml->screenshot as $v){ $game = (string) $v->game; $games[$game][] = (string) $v->filename; } foreach($games as $k => $v){ echo $k.'<br />'; foreach($v as $v2){ echo '<img src="http://screenshot.xfire.com/screenshot/small/'.$v2.'" />'; } echo '<br /><br />'; } ?> I'll leave you to format Quote Link to comment https://forums.phpfreaks.com/topic/86691-array-help-request/#findComment-443043 Share on other sites More sharing options...
Bayler Posted January 18, 2008 Author Share Posted January 18, 2008 Unfortunately No.. this has to be compatable with both PHP4 and above! Quote Link to comment https://forums.phpfreaks.com/topic/86691-array-help-request/#findComment-443050 Share on other sites More sharing options...
trq Posted January 18, 2008 Share Posted January 18, 2008 Post your current code and tell us what your actual problem is. Were not here to do it for you, your missing the entire point of this forum. Quote Link to comment https://forums.phpfreaks.com/topic/86691-array-help-request/#findComment-443055 Share on other sites More sharing options...
Bayler Posted January 18, 2008 Author Share Posted January 18, 2008 foreach($parser->document->screenshot as $screenshots){ $id = $screenshots->game[0]->tagAttrs['id']; $gn = $screenshots->game[0]->tagData; $ss = $screenshots->filename[0]->tagData; echo "<div align=\"center\"><center>" ."<table border=\"0\" width=\"100%\">" ."<tr>" ."<td><div align=\"center\"><center><table border=\"0\" width=\"100%\">" ."<tr>" ."<td align=\"center\">$gn</td>" ."</tr>" ."<tr>" ."<td align=\"center\"><a href=\"http://screenshot.xfire.com/screenshot/large/$ss\" rel=\"lightbox\"><img border=\"0\" src=\"http://screenshot.xfire.com/screenshot/small/$ss\"></a></td>" ."</tr>" ."</table>" ."</center></div></td>" ."</tr>" ."</table>" ."</center></div>"; } Quote Link to comment https://forums.phpfreaks.com/topic/86691-array-help-request/#findComment-443062 Share on other sites More sharing options...
trq Posted January 19, 2008 Share Posted January 19, 2008 You missed this part.... and tell us what your actual problem is. Quote Link to comment https://forums.phpfreaks.com/topic/86691-array-help-request/#findComment-443160 Share on other sites More sharing options...
Bayler Posted January 19, 2008 Author Share Posted January 19, 2008 the Problem is.. I dont understand HOW to group the Game Titles together and display each $gn and display each SS thats associated with the $gn Quote Link to comment https://forums.phpfreaks.com/topic/86691-array-help-request/#findComment-443184 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.