Jump to content

Array help request


Bayler

Recommended Posts

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!

[email protected]

Link to comment
https://forums.phpfreaks.com/topic/86691-array-help-request/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/86691-array-help-request/#findComment-443043
Share on other sites

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>";
}

Link to comment
https://forums.phpfreaks.com/topic/86691-array-help-request/#findComment-443062
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.