TulipTools Internet Business Owners and Online Sellers Community

Full Version: May I have some PHP coding help please?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I am trying to change my gallery over to a script that's going to work better for me, I think. One thing that is bugging me, though is that the new script is putting some junk in the tooltip over the image that I don't like. It's giving the file date creation and I don't have any need for that whatsoever. I would much prefer that it just give the file name. Here is the code:
[code=php-brief] Header("content-type: application/x-javascript");

function returnimages($dirname=".") {
  $pattern="\.(jpg|jpeg|png|gif|bmp)$";
  $files = array();
  $curimage=0;
  if($handle = opendir($dirname)) {
      while(false !== ($file = readdir($handle))){
              if(eregi($pattern, $file)){
$filedate=date ("M d, Y H:iConfused", filemtime($file));
                echo 'galleryarray[' . $curimage .']=["' . $file . '", "'.$filedate.'"];' . "\n";
                $curimage++;
              }
      }

      closedir($handle);
  }
  return($files);
}

echo "var galleryarray=new Array();" . "\n";
returnimages();
?>[/code]

I can see it in there, but I don't know how to remove it!  Tard
I don't do PHP but I thought I'd offer some sympathy, lol. Toothy10
Thanks, Bell!  Sad1  Lol Let it be known that as soon as I get that part fixed I will have another question about the javascript code that goes with this thing.  Laughing7
Try this.

[code=php]

echo 'galleryarray[' . $curimage .']=[' . $file . '];' . "\n";



[/code]

What program is it?
Hi BBH. The program is here:
http://www.dynamicdrive.com/dynamicindex...oalbum.htm
but I don't understand your advice. Surely I don't just trade all of what I for that tiny bit?
I don't know where to stick that in what you posted there.  Tard
O! I think I see where to stick it now!  Lol
[quote author=bargainbloodhound link=topic=6277.msg36092#msg36092 date=1165803518]

replace this line in that block of code:

[code=php]echo 'galleryarray[' . $curimage .']=["' . $file . '", "'.$filedate.'"];' . "\n";[/code]

with this line.  You only need to change the one line of code.

[code=php]

echo 'galleryarray[' . $curimage .']=[' . $file . '];' . "\n";



[/code]

What program is it?
[/quote]
I tried it. This is what I have uploaded now, and it doesn't work.
[code=php-brief] Header("content-type: application/x-javascript");

function returnimages($dirname=".") {
  $pattern="\.(jpg|jpeg|png|gif|bmp)$";
  $files = array();
  $curimage=0;
  if($handle = opendir($dirname)) {
      while(false !== ($file = readdir($handle))){
              if(eregi($pattern, $file)){
$filedate=date ("M d, Y H:iConfused", filemtime($file));
                echo 'galleryarray[' . $curimage .']=[' . $file . '];' . "\n";
                $curimage++;
              }
      }

      closedir($handle);
  }
  return($files);
}

echo "var galleryarray=new Array();" . "\n";
returnimages();
?>[/code]

I'm getting a blank page.
Quote:I'm getting a blank page.

Me too.  I can't get it to work without the 'file date' code which is probably because the program sorts the order in which images appear by date.
That's the whole problem! I mean, that's the other problem I was going to get to after I got the tooltip part of it solved. I've been reading about this script over there at that board, and the guy who wrote it gives solutions for these problems to people who have already asked the same questions I have, and when those people return and say that didn't work, they get no response.

It sucks. He swears up and down that it will sort them by filename if you do such and such but it will NOT. I guess I can overcome it by reuploading every bleeping image every time I add a new image so that the order will change? I don't know.

Originally I was using this script that was not the PHP version, and it worked okay, but it was very cumbersome to add a new image. That's why I thought I'd try this php version. It just almost works for me, but doesn't. So sad.

Any recommendations on a gallery proggie that will do this?

You can see what I am trying to achieve by this page:
http://www.backupforgrabs.com/TinyImages/Sports.htm
and this is the page that has the php script on it with the doopid tooltips and the files in the bad order [note the most recent file is yarn.gif and so it appears last?]
http://www.backupforgrabs.com/TinyImages/Activities.htm

grrrrrr  Tongue2
Pages: 1 2