May I have some PHP coding help please?
|
12-11-2006, 01:48 AM,
Post: #1
|
|||
|
|||
May I have some PHP coding help please?
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:i", 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! |
|||
12-11-2006, 01:57 AM,
Post: #2
|
|||
|
|||
Re: May I have some PHP coding help please?
I don't do PHP but I thought I'd offer some sympathy, lol.
|
|||
12-11-2006, 02:15 AM,
Post: #3
|
|||
|
|||
Re: May I have some PHP coding help please?
Thanks, Bell! 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.
|
|||
12-11-2006, 02:18 AM,
Post: #4
|
|||
|
|||
Re: May I have some PHP coding help please?
Try this.
[code=php] echo 'galleryarray[' . $curimage .']=[' . $file . '];' . "\n"; [/code] What program is it?
"Well, Jay was so giddy that someone named Jay was involved with this site we posted our first non-eBay listing in 3 years here at Lunarbid (we tried two items at Yahoo once upon a time, they bombed)" -Marie posting in a LunarBid thread at OTWA in 2005 wins the award for 'most moronic reason ever given for choosing a venue"
"thanks twat u must have nothing better 2 do. do u talk to all your members like that. will not be recomending your site. best way to put it is TULIPTOOLS.COM IS REALLY SHIT. DONT JOIN." -pubescent owner of rinky dink off2auction.com in 2011 |
|||
12-11-2006, 02:22 AM,
Post: #5
|
|||
|
|||
Re: May I have some PHP coding help please?
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. |
|||
12-11-2006, 02:23 AM,
Post: #6
|
|||
|
|||
Re: May I have some PHP coding help please?
O! I think I see where to stick it now!
|
|||
12-11-2006, 02:27 AM,
Post: #7
|
|||
|
|||
Re: May I have some PHP coding help please?
[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]
"Well, Jay was so giddy that someone named Jay was involved with this site we posted our first non-eBay listing in 3 years here at Lunarbid (we tried two items at Yahoo once upon a time, they bombed)" -Marie posting in a LunarBid thread at OTWA in 2005 wins the award for 'most moronic reason ever given for choosing a venue"
"thanks twat u must have nothing better 2 do. do u talk to all your members like that. will not be recomending your site. best way to put it is TULIPTOOLS.COM IS REALLY SHIT. DONT JOIN." -pubescent owner of rinky dink off2auction.com in 2011 |
|||
12-11-2006, 02:29 AM,
Post: #8
|
|||
|
|||
Re: May I have some PHP coding help please?
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:i", 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. |
|||
12-11-2006, 02:54 AM,
Post: #9
|
|||
|
|||
Re: May I have some PHP coding help please?
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.
"Well, Jay was so giddy that someone named Jay was involved with this site we posted our first non-eBay listing in 3 years here at Lunarbid (we tried two items at Yahoo once upon a time, they bombed)" -Marie posting in a LunarBid thread at OTWA in 2005 wins the award for 'most moronic reason ever given for choosing a venue"
"thanks twat u must have nothing better 2 do. do u talk to all your members like that. will not be recomending your site. best way to put it is TULIPTOOLS.COM IS REALLY SHIT. DONT JOIN." -pubescent owner of rinky dink off2auction.com in 2011 |
|||
12-11-2006, 03:14 AM,
Post: #10
|
|||
|
|||
Re: May I have some PHP coding help please?
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 |
|||
« Next Oldest | Next Newest »
|
Users browsing this thread: 1 Guest(s)