<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
The fundamental problem is that the theme selection must be done at PHP
runtime on the web server, while any JavaScript used to determine
resolution (or view port size) will run well after this stage at the
client. With a strait forward approach of PHP running on the server to
deliver a webpage, there is no way for the PHP to know the screen
resolution at runtime. <br>
<br>
But, it is possible if you take a two stage approach, I don't know of
any theme that actually does this though (but that's not to say that
there aren't any).<br>
<br>
Stage 1 is the initial page request. The PHP runs and serves JS to the
client. When that JS runs, it can determine the screen resolution and
use the values for the request of the second stage.<br>
<br>
Stage 2 is the JS requesting that same page again, but with the
resolution values as part of the request.<br>
<br>
A snippet could roughly look like this:<br>
<br>
<tt><?php<br>
if ($_GET['screenx'] && $_GET['screeny']) {<br>
<br>
// $_GET['screenx'] and $_GET['screeny'] are our resolution values<br>
// make any decisions you want based on them, theme selection, etc..<br>
<br>
}<br>
else {<br>
</tt><code><span class="html"><span class="keyword">// this assumes
HTTP, adapt as needed. Use request_uri() to work on non apache servers
too</span></span></code><br>
<tt> </tt><code><span class="html"><span class="default">$url =
'<a class="moz-txt-link-freetext" href="http://">http://</a>' . </span></span></code><code><span class="html"><span
class="default">$_SERVER</span><span class="keyword">[</span><span
class="string">'SERVER_NAME'</span><span class="keyword">] . </span></span></code><code><span
class="html"><span class="keyword">request_uri()</span></span></code><code><span
class="html"><span class="keyword">; </span></span></code><br>
<tt> print <<<ENDJS<br>
<script><br>
location.href = $page + '&screenx=' </tt><tt>+ screen.width +
'&screeny=' + </tt><tt>screen.height;</tt><br>
<tt> </script><br>
</tt><tt>ENDJS;<br>
exit;<br>
}<br>
?></tt><br>
<br>
Keep in mind though that if you are turning each request into two
requests you could run into performance issues. Better to store the
resolution values in $user['session'].<br>
<br>
<br>
-Seth<br>
<br>
Florent JOUSSEAUME wrote:
<blockquote cite="mid:49159019.7020009@makina-corpus.com" type="cite">
<pre wrap="">-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The resolution depends on your browser's size. You can be with a
resolution of 1280x1024 but your browser with a size of 800x600.
bharani kumar a écrit :
</pre>
<blockquote type="cite">
<pre wrap="">Sorry if i understood wrongly,
Actually question is different theme based on resolution , not an size
Thanks
On Sat, Nov 8, 2008 at 1:37 PM, sivaji j.g <<a class="moz-txt-link-abbreviated" href="mailto:sivaji2009@gmail.com">sivaji2009@gmail.com</a>
<a class="moz-txt-link-rfc2396E" href="mailto:sivaji2009@gmail.com"><mailto:sivaji2009@gmail.com></a>> wrote:
to display a different theme based on a users
screen resolution?
I think you can do this with java script
<script type="text/javascript">
function alertId()
{
alert(screen.width);
alert(screen.height);
}
</script>
Now you know the resolution of user, just call the required
theme. Module is not required for this .
--
Thanks a lot
-----------------------------------------
<a class="moz-txt-link-freetext" href="http://ubuntuslave.blogspot.com/">http://ubuntuslave.blogspot.com/</a>
--
[ Drupal support list | <a class="moz-txt-link-freetext" href="http://lists.drupal.org/">http://lists.drupal.org/</a> ]
--
உங்கள் நண்பன்
பரணி குமார்
Regards
B.S.Bharanikumar
POST YOUR OPINION
<a class="moz-txt-link-freetext" href="http://bharanikumariyer.hyperphp.com/">http://bharanikumariyer.hyperphp.com/</a>
</pre>
</blockquote>
<pre wrap=""><!---->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - <a class="moz-txt-link-freetext" href="http://enigmail.mozdev.org">http://enigmail.mozdev.org</a>
iEYEARECAAYFAkkVkBMACgkQ3nayFuuvNJOyTACggBt8lZGqx/FPPbiHkpd8kRZW
UN4AoJJeXPJ+vpszBL58BRr5DFnFdVkZ
=xate
-----END PGP SIGNATURE-----
</pre>
</blockquote>
</body>
</html>