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!

baylerfl@msn.com

Link to comment
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.