php-general | 2001072
Date: 07/17/01
- Next message: Petr Jùza: "[PHP] displaying icons"
- Previous message: Fredrik A. Takle: "[PHP] Re: Output (Urgent!)"
- Maybe in reply to: Fredrik A. Takle: "[PHP] Output (Urgent!)"
- Next in thread: Jason Rennie: "Re: [PHP] Output (Urgent!)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I don't think this code do what he want... You are trying to mix
client-side code with server-side code, but you can't do in that way.
The ONLY way to obtain client screen resolution into a PHP variable is
send data from client to server.
> -----Original Message-----
> From: Morten Winkler Jørgensen [mailto:madmax <email protected>]
> Sent: 17 iulie 2001 12:14
> To: php-general <email protected>
> Subject: RE: [PHP] Output (Urgent!)
>
>
> Hi Frederik
>
> Run this code. It does what you want it to.
> In your original code you compared two strings in the IF-statement.
> When the $resolution gotten from your JavaScript returned
> '800' it would
> have a lexical higher value than '1024' and thereby do exacely what
> you wanted it to - actually the code would always return \1024\ since
> your screen resolution would never return a string with a lexical
> lower value than '1024'.
>
> By multiplying the string '1024' by 1 you get the integervalue 1024
> (that's a trick PHP offers ;) ) which you then compare to the
> integervalue 1024.
>
> That's the trick....
>
> $resolution = "<SCRIPT
> LANGUAGE=\"JavaScript\">document.write(screen.width)</SCRIPT>";
> echo "--".$resolution."--";
> if (($resolution*1) >= 1024) {
> $resolution = "1024";
> } else {
> $resolution = "800";
> }
> echo "**".$resolution."**";
>
> Venlig hilsen ha' en bra dag,
> Morten Winkler
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe <email protected>
> For additional commands, e-mail: php-general-help <email protected>
> To contact the list administrators, e-mail:
> php-list-admin <email protected>
>
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Petr Jùza: "[PHP] displaying icons"
- Previous message: Fredrik A. Takle: "[PHP] Re: Output (Urgent!)"
- Maybe in reply to: Fredrik A. Takle: "[PHP] Output (Urgent!)"
- Next in thread: Jason Rennie: "Re: [PHP] Output (Urgent!)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

