HI Guys,
I am almost there. With the code below I manged to look for files in a certain directory.
function getDirectoryList($directory)
{
$folder="/var/www/vhosts/wezzbite.nl/httpdocs/Silverstripe/themes/blackcandy/images/photos/".$directory;
// create an object to hold directory list
$icons = new DataObjectSet();
// create a handler for the directory
$handler = opendir($folder);
// open directory and walk through the filenames
while ($file = readdir($handler)) {
// if file isn't this directory or its parent, add it to the results
if ($file != "." && $file != ".." && substr($file,0,6)!="thumb_") {
$icons->push(new ArrayData(array(
'File' => $file
)));
}
}
// tidy up: close the handler
closedir($handler);
// done!
//return $results;
return $icons;
}
Now I only need to have the URL displayed in my HTML, but somehow it isn't displayed:
<% control getDirectoryList($URLSegment) %>
<a href="/Silverstripe/themes/blackcandy/images/photos/$URLSegment/$File" rel="prettyPhoto[pp_gal]" $Title><img src="/Silverstripe/themes/blackcandy/images/photos/$URLSegment/thumb_$File" border="0" width="48" height="48" alt="van Leeuwen PHP test"></a>
<% end_control %>
What am I missing?
I have tried this but this does not work either: http://www.silverstripe.org/template-questions/show/11215
Thanks
Wesley