I suggest you use JavaScript rather than PHP, because when using server side
scripts, you most probably need to use functions/variables out of the
Document Object Model (DOM).
When you use JavaScript, no extra trafic is generated on the
network/internet, and that isn't even necessary!
Specificaly, use the javascript variables
"document.body.clientWidth|clientHeight", inside a JavaScript. When these
variables, that represent the number of pixels of the browser-window, are
read, then you can draw anything to the screen that fits into these values
of pixels. You don't need separate css-stylesheets or tables, as mentioned
by the other posters in this thread!
E.g.
<script language="JavaScript">
<!--
alert(document.body.clientWidth); // displays the width of the
// browser-window
-->
</script>
(I allready posted this message, but it was only sent to JeRRy. Oops!)
----- Original Message -----
From: "Neil Smith [MVP, Digital media]" <php@xxxxxxxxxxxxxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Sunday, February 05, 2006 7:17 PM
Subject: Re: Subject: screen resolution!
At 08:41 05/02/2006, you wrote:
Message-ID: <20060204154419.49614.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 5 Feb 2006 02:44:19 +1100 (EST)
From: JeRRy <jusa_98@xxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="0-733704850-1139067859=:48594"
Content-Transfer-Encoding: 8bit
Subject: screen resolution!
Hi,
I have written a website in PHP using MYSQL. But I have come accross
an un-common problem. Normally when I create a website it's done on a
desktop PC. But this time for the first time I did it on laptop meaning
the screen resolution is different.
Is there any sort of script/code I can use to create another section of
my site in a desired screen resolution without me having to do it all
manually?
I would really recommend that screen size / resolution detection is no
longer the way forward. It's perfectly possible to use CSS +/- XHTML
correctly to have the page reflow without all the stylesheet switching
hacks that would be required in the 'old school' (read : 1999) way of
doing things.
You'd need to use structural markup rather than try to 'force to fit' with
tables etc, but it's entirely possible to generate flexible layouts that
can display on any device, even a PDA, without screen size detection.
Search engines like sematic layout too, and your menu for example may not
be the first thing they or a screen reader encounters in the page - though
it may *appear* at the top of the page due to CSS telling it where to be
displayed.
Here are some links for you to consider : all are worth reading and
digesting from end to end.
http://glish.com/css/8.asp
http://www.alistapart.com/stories/journey/
http://www.positioniseverything.net/articles/onetruelayout/
http://www.csszengarden.com/
I know of many scripts online that I can DETERMINE visitors screen
resolutions and recommend the
** Assuming javascript is turned on, or even the display device supports
that detection.
And bear in mind, many users *may not wish* to have their browser
maximised just to view your site.
HTH
Cheers - Neil
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php