ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-france
php-france
Re: [php-france] =?ISO-8859-1?Q?R=E9cup=E9ration_de_la_r=E9?= =?ISO-8859-1?Q?solution_=E9cran_du_client?=
by charlies other posts by this author
Nov 9 2002 1:30AM messages near this date
Re: [php-france] Récupération de la résolution écran du client | Re: [php-france] php - email -html
BibiLefou wrote:

 >  Possible qu'en couplant PHP et Javascript.
 > 
 >  Tu fais une fonction de détection en javascript. Ta fonction doir
 >  comporter
 >  :
 >  - Détection de la résolution,
 >  - Transmission des valeurs au script PHP.
 > 
 >  La fonction JS :
 >  function checkResolution() {
 >   document.location="script.php?w="+screen.width+"&h="+screen.height;
 >  }
 > 
 >  Pis dans ton code PHP de script.php, tu récupère les varaiable $w
 >  (largeur)
 >  et $h (hauteur).
 >  Après, libre à toi d'effectuer un traitement en fonction des valeurs
 >  de ces
 >  2 dernières.
 > 
Sympa ton aide, j'ai testé mais j'ai pas trop compris la récupération de
   ?w dans php alors j'ai fait différemment en me basant sur ton exemple.
C'est pas encore totalement au point mais sa prend forme.

En gros j'ai fais une tit truc de la forme suivante avec JavaScript et 
PHP pour commencer.
------------------------------------------------------------------------
<SCRIPT LANGUAGE="JavaScript"> 
	<!--
		function checkResolution() {
			document.location="?w="+screen.width+"&h="+screen.height;
	}
	//--> 
	</SCRIPT> <?php
		if(($w> ="262") && ($w<="592")) { print"320x240"; }
	elseif(($w> ="592") && ($w<="702")) { print"640x480"; }
	elseif(($w> ="702") && ($w<="922")) { print"800x600"; }
	elseif(($w> ="922") && ($w<="1142")) { print"1024x768"; }
	elseif(($w> ="1142") && ($w<="1252")) { print"1152x864"; }
	elseif(($w> ="1252") && ($w<="1582")) { print"1280x1024"; }
	elseif(($w> ="1582") && ($w<="1692")) { print"1600x1200"; }
	elseif(($w> ="1692") && ($w<="1692")) { print"1792x1344"; }
	elseif(($w> ="1692") && ($w<="1802")) { print"1800x1440"; }
	elseif ($w> ="1802") { print"1832x1392"; }
	?> 
------------------------------------------------------------------------
Ne connaissant pas trop les subtilités entre JavaScript et PHP, je 
pensais au début que vue leur parenté à C il m'aurait suffi de passer la 
variable $w simplement dans mon code mais non.

J'ai testé d'autre manière mais celle-ci est à mon avis la plus potable 
que j'ai pu sortir et, ne marque aucun msg d'erreur temps au niveau 
JavaScript que PHP.

A partir de la je ne voie plus très bien ce que je pourrais faire pour 
que sa fonctionne.


-- 
   ("`-''-/").___..--''"`-._
    `6_ 6  )   `-.  (     ).`-.__.`)
    (_Y_.)'  ._   )  `._ `. ``-..-'
     `--'_..-_/  /--'_.' ,'
(ll).-''  (((!.'  ((!.-'
LACAILLE Charles-Philippe
Infographiste - Multimédia

charlies@scritpograph.com
Thread:
charlies
BibiLefou
charlies
BibiLefou
charlies
BibiLefou
charlies
lulu
Tanguy Crollen
Tanguy Crollen
lulu
Tanguy Crollen
lulu
Olivier Meunier
BibiLefou
Didier DEMAISON

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved