Codice PHP:
<?xml version="1.0" encoding="utf-8"?>
<images>
<image id="0">
<photo>1.png</photo>
<caption>001</caption>
<tipo>1</tipo>
</image>
<image id="1">
<photo>2.png</photo>
<caption>002</caption>
<tipo>1</tipo>
</image>
<image id="2">
<photo>3.png</photo>
<caption>003</caption>
<tipo>1</tipo>
</image>
<image id="3">
<photo>4.png</photo>
<caption>002</caption>
<tipo>1</tipo>
</image>
<image id="4">
<photo>5.png</photo>
<caption>002</caption>
<tipo>1</tipo>
</image>
</images>
Codice PHP:
<?php 
$id 
$_GET['id'];
    
$i $id;
    
$next $i+1;
    
$prev $i-1;
    
$xml simplexml_load_file('image.xml');
$totale=count($xml->image); 
foreach (
$xml->image as $image) {
    
$id $image {'id'} ;
    if (
$i == $id) {
        
$photo $image->photo;
        echo 
"photo: ".$photo."
"
;
    }
}
?>
[url="player.php?id=<?php echo $prev?>"]indietro[/url]
[url="player.php?id=<?php echo $next?>"]avanti[/url]
Così funziona ma penso che si possa fare anche di meglio