Re: Re: limiting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PLEASE SEE MY COMMENTS INTERSPERSED AND BELOW.
(yes this is a top post)

On 10/9/2012 3:18 PM, David McGlone wrote:
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.


NOT IN THIS SCRIPT!!

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.


$MATCH WOULD WORK; $MATCHES WOULD NOT. It's suppose to be a 'name' - so why would you put an array reference in the Rel attribute?


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.



THATS' CAUSE YOU DIDN'T LABEL THEM WITH $MATCH!


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.

I HAVE USED LB - IT DOESN'T HIDE THINGS. IT DISPLAYS THINGS. THINGS THAT YOU PROVIDE - WHETHER YOU HAVE THEM HIDDEN OR NOT. Feel free to check out a site I developed - voorheesvilefd.org. This site uses plenty of php and LB to display random photos drawn from folders across the site.

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.


AGAIN - THE THINGS YOU ARE TRYING ARE WAY BEYOND YOUR CURRENT SKILL LEVELS.

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?

YOU HAVE READ THE WRONG BOOKS. FIVE OF THEM AND YOU DIDN'T LEARN THE DIFF BETWEEN A RETURN AND AN ECHO? Five of them? Really? And you didn't think to buy a book better than the first two were?

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.

no you don't need to be a professional. You need to be at least halfway informed. If you were asking questions about introductory scripts you would be given the help you need. But you are asking for help with things that are very complicated and you still haven't learned the basics. Start from the beginning and work your way up to this. Really. And if the code you posted here was something you were tinkering with and lost sight of what you had done, it really shows that you don't have a lot of understanding of php, arrays, variables or html at all.

Yes - this can be fun. I love creating stuff every chance I get, and I help people when I can with their problems. But you can't dive into the deep end until you've learned the doggie paddle at least. Please, please trust me. If you are a only a few days from having to have Return and Echo explained to you, you are weeks away from this exercise ever making sense for you.

So - now that you've had your epiphany from this morning's responses, what does your script look like now?
  --
David M.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux