Jump to content
xisto Community
owbussey

Php Error In Photo Gallery: Need Help

Recommended Posts

I get this error when i go to the following url: gallery

Fatal error: Call to undefined function: scandir() in /home/owbussey/public_html/New Folder (2)/functions.php on line 18

I have been doing some research and it seems that the function scandir() is php 5. Is that correct? If it is how can I make it work on Xisto? I will post the code to the file. I do not know whether the error will be best seen in the context of all of the source code. Here is a link to a zip file download of the source code (I did not want to take up a lot of space with an entire page of source code):

source code download

Share this post


Link to post
Share on other sites

Yeah - that's a php 5 command. So, there really isn't any way to make it work on Xisto. I'm sure they will switch to it when it's stable, though. Unless it's absolutely required to have it, you MAY be able to edit it out somehow. I'm not sure about that, though. You'll have more of a chance messing it up than making it work. :lol:

Share this post


Link to post
Share on other sites

Yes, scandir() is a php5 function, but the same effect can be had by using opendir(), readdir(), etc.

<?php$dir = "/tmp";$dh  = opendir($dir);while (false !== ($filename = readdir($dh))) {	$files[] = $filename;}sort($files);print_r($files);rsort($files);print_r($files);?>

The scandir() only makes your code shorter and more efficient, but the php4 method is also effective.

Share this post


Link to post
Share on other sites

Welll here is a code that you can use to see all the files in a directory:

<?phpif ($handle = opendir('.')) {   while (false !== ($file = readdir($handle))) {	   if ($file != "." && $file != "..") {		   echo "$file\n";	   }   }   closedir($handle);}?>


Since you want only images(I assume this as you are using it for a photo gallery) you will need to make a few changes.

Well this will work for all the files and also some sub-directories and its sub directories.To find only images you will need to use either the name of the file and its type to find the image files only.
Hope this will help you in finding the thinhs you require.

Have a good day.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.