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
?>
<?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.
Ho modificato così e ora funziona:
<img src="<?php print $dir.'/'.$file ?>" width="950" height="355" alt="slideshow 1"/>