RE: [PHP] Screen Size?

2001-02-26 Thread Todd Kerpelman

> How do you determine a user's screen size (resolution)?  Isn't there a
> variable/function for this?

I doubt you could do this in PHP, since your browser doesn't normally
include screen size information in the headers it sends across to web
servers.

However, JavaScript can do this -- there's a screen object, with properties
called screen.width and screen.height that specify (surprisingly enough) the
width and height of the user's screen.

You could create a form with some hidden inputs, and have a JavaScript body
onLoad() event that would set the values of these hidden inputs to your
user's screen size. When PHP receives this form. it could process the
information from there.

Hope this helps...

--Todd


> -Original Message-
> From: Jason Bryner :: Focus Design Group, Inc.
> [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, February 25, 2001 10:52 PM
> To: PHP
> Subject: [PHP] Screen Size?
> 
> 
> How do you determine a user's screen size (resolution)?  Isn't there a
> variable/function for this?
> 
> 
> --
> Focus Design Group, Inc.
> http://www.focusdesigngroup.com
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 



RE: [PHP] Table looking odd as a result of while loop?

2001-02-26 Thread Todd Kerpelman

Hmmm... I'm pretty sure 1%3 is equal to 1. 

I'm suspecting you might be incrementing $photocount too early -- that is,
before the if (($photocount % 3) == 2)  statement. That would certainly
explain the weirdness you're seeing.

--Todd


> -Original Message-
> From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 26, 2001 1:57 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Table looking odd as a result of while loop?
> 
> 
> Is it because 1 % 3 is 0 with a remainder of 2? Looks like 
> the code is doing
> just what it is written to do. The "if" evaluates to true on 
> the second
> picture.
> 
> Kirk
> 
> -Original Message-
> From: James, Yz [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 26, 2001 2:55 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Table looking odd as a result of while loop?
> 
> 
> Hi all,  This is probably something dumb I'm missing, but I 
> am using the
> following code:
> 
> echo "\n";
> 
> echo "\n";
> $photocount = 0;
> 
> while($row = mysql_fetch_array($result)) {
>  $smallpic = $row['smallpic'];
> 
>  if (($photocount % 3) == 2) {
>  echo "\n\n";
>  }
> 
> (There are currently 8 pics that have been uploaded).  As you 
> can see that
> the first row has returned just two columns.  I'd like the 
> photos to be
> displayed in rows of three, and if there are only 8 pictures 
> (or any othe
> number that's not directly divisible by three) to be 
> displayed on the last
> row.   At the moment it's doing it "upside down."  Any ideas?
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 



RE: [PHP] Table looking odd as a result of while loop?

2001-02-26 Thread Todd Kerpelman

Sorry. Take that back. Just saw the original post.

The problem is that you're doing the  stuff AFTER deciding whether you
want to change rows or not. Imagine going through the list below when you're
on $photocount=2, which is really the third picture. 

while($row = mysql_fetch_array($result)) {
 $smallpic = $row['smallpic'];

 if (($photocount % 3) == 2) {
 echo "\n\n";
 }

 echo "$smallpic\n";
 $photocount++;

}

See what happens? You end the current table row, and THEN print out the
third table cell, which really ends up on the next row. 

Just move that echo statement about your if statement (leave the
auto-increment where it is), and you should be fine. 


--Todd


> -Original Message-
> From: Todd Kerpelman 
> Sent: Monday, February 26, 2001 2:10 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Table looking odd as a result of while loop?
> 
> 
> Hmmm... I'm pretty sure 1%3 is equal to 1. 
> 
> I'm suspecting you might be incrementing $photocount too 
> early -- that is,
> before the if (($photocount % 3) == 2)  statement. That would 
> certainly
> explain the weirdness you're seeing.
> 
> --Todd
> 
> 
> > -Original Message-
> > From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, February 26, 2001 1:57 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP] Table looking odd as a result of while loop?
> > 
> > 
> > Is it because 1 % 3 is 0 with a remainder of 2? Looks like 
> > the code is doing
> > just what it is written to do. The "if" evaluates to true on 
> > the second
> > picture.
> > 
> > Kirk
> > 
> > -Original Message-
> > From: James, Yz [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, February 26, 2001 2:55 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Table looking odd as a result of while loop?
> > 
> > 
> > Hi all,  This is probably something dumb I'm missing, but I 
> > am using the
> > following code:
> > 
> > echo "\n";
> > 
> > echo "\n";
> > $photocount = 0;
> > 
> > while($row = mysql_fetch_array($result)) {
> >  $smallpic = $row['smallpic'];
> > 
> >  if (($photocount % 3) == 2) {
> >  echo "\n\n";
> >  }
> > 
> > (There are currently 8 pics that have been uploaded).  As you 
> > can see that
> > the first row has returned just two columns.  I'd like the 
> > photos to be
> > displayed in rows of three, and if there are only 8 pictures 
> > (or any othe
> > number that's not directly divisible by three) to be 
> > displayed on the last
> > row.   At the moment it's doing it "upside down."  Any ideas?
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: 
> > [EMAIL PROTECTED]
> > 
>