Page 1 of 1
screen size
Posted: Tue Oct 07, 2003 5:18 pm
by gavinbsocom
Is there a function or method or w/e in php that determines the screen size of a persons monitor whether its 1024 x 768 or 800 x 600 ? and if so, does it load a different page? and if so do you need to make 2 seperate pages? or something?
Posted: Tue Oct 07, 2003 5:32 pm
by Unipus
PHP can't do it. Javascript can. Javascript + PHP could also do it together, but if you're already reliant on js you might as well finish the job.
Depending on your content, you'd either build two different versions of the pages (ick) or two different style sheets.
Posted: Tue Oct 07, 2003 5:55 pm
by m3mn0n
grab the java script code, it's easily availible online, google around for a good one.
then transfer the variable to a php switch page
Code: Select all
<?php
$screensize = ""; // insert js variable here
switch ($screensize){
case "800x600":
header ("whatever.php");
break;
}
// continue for other sizes
?>
Posted: Tue Oct 07, 2003 6:01 pm
by Paddy
Not saying that Sami is wrong in any way but I would use a session variable and set it to the resolution. This way you would not need whatever800.php and whatever1024.php and the resolution would be easily passed through your entire site.
Of course, if someone changes their resolution mid session then there would be a problem. But I am sure not many people would do that.
Posted: Thu Oct 09, 2003 5:04 pm
by cybaf
the use of different stylesheets as suggested above would be the "best" solution. that way you would not need different versions of your html/php code and no session that _could_ possibly not work when a user changes resolution..
//cybaf