Tema Danland slideshows e directory inesistente

2 contenuti / 0 new
Ultimo contenuto
Tema Danland slideshows e directory inesistente

Ho inserito questo codice
<?
$images = Array();
print $base_path."";
print $directory."";
$dir = $base_path . $directory.'/images/slideshows';
print $dir."";
if ( file_exists($dir) )
{ $handle = opendir ( $dir );
while ( false !== ( $file = readdir($handle) ) )
{ if ( is_file($dir.$file) )
{ array_push($images,$file);
}
}
$handle = closedir($handle);
}
else echo "Directory Inesistente!";

foreach ($images as $file) {?>

<?php
 
print $base_path . $directory.'/images/slideshows/'.$file
?>
" width="950" height="355" alt="slideshow 1" />
<?php
 
}
?>

all'interno del file page.tpl.php con l'intento di caricare tutte le immagini nella cartella screenshots.
Risultato:
Directory inesistente.

Il sorgente HTML risultante a causa delle echo di controllo che ho aggiunto all'inizio del codice contiene la riga:

/coop/<br/>sites/all/themes/danland<br/>/coop/sites/all/themes/danland/images/slideshows<br/>Directory Inesistente!</div>

In realtà la directory esiste. Qualcuno può gentilmente aiutarmi a capire cosa c'è che non va? Grazie.

Drupal Version:

Ho modificato così e ora funziona:

<?php
$images
= Array();
$dir = 'sites/all/themes/danland/images/slideshows';
if (
file_exists($dir) )
{   
$handle = opendir ( $dir );
    while (
false !== ( $file = readdir($handle) ) )
    {    if (
is_file($dir."/".$file) )
        {   
array_push($images,$file);
        }
    }
   
$handle = closedir($handle);
}
else echo
"Directory Inesistente!";
foreach (
$images as $file) {
?>

<img src="<?php print $dir.'/'.$file ?>" width="950" height="355" alt="slideshow 1"/>
<?php
 
}
?>