Hi, long time lurking, finally signed up!, I need some help, I’m learning to programme this PHP stuff and I’m stuck!
This works…
[php]
<?php echo '- ';
$dir0 = '../images0';
$file_display = array('jpg', 'jpeg', 'png');
if (file_exists($dir0)== false)
{
echo 'Directory \'', $dir0, '\' not found!';
}
else
{
$dir_contents = scandir($dir0);
foreach ($dir_contents as $file)
{
$file_type = strtolower( end (explode ('.', $file)));
if($file !== '.' && $file !== '..' && in_array($file_type, $file_display)== true)
{
echo '
[/php]
I would like to be-able to add more directories which can be pulled by this script, I’ve got this …
[php]
<?php
echo ‘
- ’;
$dir0 = ‘…/imgages0’;
$dir1 = ‘…/images1’;
$file_display = array(‘jpg’, ‘jpeg’, ‘png’);
if (file_exists($dir0)== false)
{
echo ‘Directory ‘’, $dir0, ‘’ not found!’;
}
else
{
$dirlist =array($diro, $dir1);
$dir_contents = scandir($dirlist);
foreach ($dir_contents as $file)
{
$file_type = strtolower( end (explode (’.’, $file)));
if($file !== ‘.’ && $file !== ‘…’ && in_array($file_type, $file_display)== true)
{
echo ‘
}
}
}
echo ‘
?>
[/php]
Am I heading down the right road with this ? some help and advice would be amazing thanks guys