Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/09/2011, 09:55
Avatar de el_tigre
el_tigre
 
Fecha de Ingreso: febrero-2006
Ubicación: Perú
Mensajes: 1.044
Antigüedad: 18 años, 3 meses
Puntos: 8
De acuerdo mostrar último archivo

Amigos, tengo unos archivos mp3 que guardo en una carpeta y que se ordenan en base al año, mes y día, yo quisiera poder mostrar mi player sólamente con el último archivo puesto..... ¿cómo podría hacerlo?

Actualmente muestro todos los archivos ordenados desde el último ingreso hasta los más antiguos....

Código PHP:
<?php

$filter 
".mp3";

$directory=$_GET['music'];

@
$d dir($directory);
if (
$d) { 
    while(
$entry=$d->read()) {  
        
$ps strpos(strtolower($entry), $filter);
        if (!(
$ps === false)) {  
            
$items[] = $entry
        } 
    }
    
$d->close();
    
rsort($items);
}



// third, the playlist is built in an xspf format
// we'll first add an xml header and the opening tags .. 
header("content-type:text/xml;charset=utf-8");

echo 
"<?xml version='1.0' encoding='UTF-8' ?>\n";
echo 
"<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
echo 
"    <title>Sample PHP Generated Playlist</title>\n";
echo 
"    <info>http://www.jeroenwijering.com/</info>\n";
echo 
"    <trackList>\n";

// .. then we loop through the mysql array ..
for($i=0$i<sizeof($items); $i++) {

$archivo=array_reverse(explode(".mp3",$items[$i]));
$archivo=$archivo[1];

    echo 
"        <track>\n";
    echo 
"            <annotation>".($i+1).". ".$archivo."</annotation>\n";
    echo 
"            <location>".$directory.'/'.$items[$i]."</location>\n";
    echo 
"            <info></info>\n";
    echo 
"        </track>\n";
}
 
// .. and last we add the closing tags
echo "    </trackList>\n";
echo 
"</playlist>\n";

?>
He intentado modificar en esta línea

Código PHP:
// .. then we loop through the mysql array ..
for($i=0$i<sizeof($items); $i++) { 
Pero no he tenido éxito,

saludos