• Hi,

    I’m having problems with the following code. I am trying to use opendir($dirpath); to open a folder location so I can list images in it.

    $dirpath = get_stylesheet_directory() . "/imagefolder";
    $folder = opendir($dirpath);

    The only problem is opendir() only seems to recognise the url generated from get_stylesheet_directory(), I’m assuming this has something to do with the absolute path from server.

    Using get_stylesheet_directory() It will read the directory and the files within it, but the absolute server url ie.

    /var/sites/t/….

    breaks the image path.

    When I use get_stylesheet_directory_uri() to get a http:// url it won’t opendir.

    Warning: opendir(url) [function.opendir]: failed to open dir: not implemented in /var/sites/t/thebritishedition.co.uk/public_html/wp-content/ on line 23

    Any help would be appreciated as I can’t seem to get this to work.

    Thanks

The topic ‘Problem with opendir & get_stylesheet_directory() absolute paths’ is closed to new replies.