Wow, am I glad I found you guys. The CSS forums I normally frequent are a little weak in PHP, so I hope someone might be able to help. PHP is something I've recently started playing with, but have been coding websites for a while.
Ok, so the issue is that I managed to write a PHP script in a static site to load images from a directory, and load them into a list which has been styled with CSS. The script works perfectly. The key to the load is the path of the directory, which I pass in as a variable...
$tempDir = "/images/"
The problem arises when I try to change the value of the variable to a Wordpress shortcode combined with a relative path.
I've included the code here:
$tempDir = get_bloginfo('template_url') . '/img/gallery/generic/';
//$tempDir = '/img/gallery/generic/'; works on the static site
$myDirectory = opendir($tempDir);
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
closedir($myDirectory);
$indexCount = count($dirArray);
echo $indexCount;
The echo at the end is just so I can see whether the array is populating... which it's not. There is another piece of code to do the load, but that seems to be fine.
Is someone able to help?