On Tuesday, October 09, 2012 12:18:06 PM Jim Giner wrote: > On 10/8/2012 11:11 PM, David McGlone wrote: > > Hi all, > > > > is there any other way to limit this code to only displaying 1 image other > > than using return. When I use return, I can't get the other images to > > display in lightbox, but when I use echo, all 5 of the images will > > correctly display in lightbox, but they are also displaying on the page. > > > > $result = mysql_query("SELECT * FROM properties"); > > > > $row = mysql_fetch_array($result); > > $matches = glob('images/property_pics/212006966/' .$prefix. '*'); > > foreach($matches as $match){ > > echo "<a href=$match rel='lightbox[$matches]' /><img src = > > > > $match></a>"; > > > > I'm not even sure if this is possible, but thought I'd ask before I > > scrapped the idea. I've been at this code since last thursday trying to > > learn as much as I can about it and I just keep going in circles and I'm > > starting to feel like glob() is what is limiting me. I've tried various > > code blocks with things like where(), str_repeat, basename, scandir, sort > > etc with no luck. :-/ > I hate to sound condescending, but you are showing some serious > deficiencies in your programming ability. I have to say that you are > tackling some very complex processes without the basic understanding of > programming that one needs. What I base this opinion on is that since > you first revealed your lack of understanding of Return and echo in php, > you have spent another 3 days and STILL don't understand? Really?
I was afraid when I first posted that question, it would give that impression. I've known what echo does, but not very much about return. Also a part of me has always wondered when I'm studying code from things like wordpress I don't think I have seen any echo statements. If I did it was very very few. (hint: why I asked about templeting systems about a month ago.) > > As for the code above - once again it looks like you have posted a > re-typing of some code you have tried to execute. I say that because > you have a query and a fetch of one record of the results THAT HAS > NOTHING TO DO WITH THE REST OF THE CODE! The query is geting a number out of the database and putting the value in $prefix. > Also - you have an array > being used as part of the Rel tag? What's up with that? (I think you > meant to use $match - but that further verifies that this is NOT the > code you ran.) I tried using $match and $matches because I got confused there for a bit and changed it. > > Finally - the code is (from your description) doing exactly what it is > designed to do (the running code that is). It sure is, and I found out what my whole problem was this morning before I went to work. My problem was lightbox was not putting all the images in $match. but I never suspected it until Matijn and Marco, posted an example of code and It turned my attention to the piece of code....... put a bunch of images in a folder and try running the code..... You'll see what I'm talking about. > All the (repeated) "echo" > statements are going to put something on your web page. Yes I was getting stuff on the page, and then when I'd try and build onto the idea, and things broke, I'd try something else, and something else, until finally I'm all confused with it. for example I'd forget to terminate something and get a blank screen and imediately suspect it was the new code I introduced. After the millionith time I started realizing when I get a blank screen, I forgot my semicolon at the end of a line somewhere. > The question > you have is (apparently) how to hide them, since I believe Lightbox is > going to have to have them present in order to do its thing. That's part of it. the other part is that lighbox is supposed to do that automatically and it should, and that's another reason I was getting confused. like I said earlier run the code and you'll see what I'm saying. > And so - > in parting - I think you need to develop some html knowledge to > facilitate that "hiding" part and some immediate skills in the general > area of programming and learning to locate and read the right manuals. > "Glob" is the least of your concerns. > > Yes - I'm being rough (I say this to you David as well as the rest of > the community that is still interested in this post) but somebody has to > make you realize that you are seriously in over your head and don't even > know it. I've said it many times, I am doing this to try and further my knowledge in PHP and get past the basic echoing of variables and strings, and this is nothing more than practice. > Have you read a book on php and perhaps one on CSS to help > with your "hiding" problem? (BTW - that last was a hint.) I've read plenty of PHP books I own at least 5 and ALL of them I've read hardly ever explain anything at all. They just throw some code in there and say "this is what it does" and gives a picture of the finished product. Total waste of my money! Also, how am I going to learn PHP if I've got to mix it all up with CSS. It's just going to make things harder and more confusing on me. I only threw lightbox in there because I knew I didn't have to do or learn anything special and to put a smile on my face if it worked. After all, if it can't be fun, why do it? > > AND PLEASE - don't post supposed "code snippets" again. Let us see what > you really ran if you want us to help. > Or do you not know how to copy > and paste either? I/we can't help you if we can't see it. That and only that is what I was running. I had changed it so many times trying to learn that if something was screwed up, it was probably because, before I posted, I had forgot to change it back. > > Sorry to be so blunt. It's fine I kinda figured I'd be either ignored, or yelled at when I asked and I now know that I need to be a professional to ask questions here so there went my confidence. -- David M.