HalifaxPiper Posted May 28, 2006 Share Posted May 28, 2006 I want to include a PHP file depending on the screen resolution.I do it in html using this jscript. eg. <script language="Javascript"><!--if (screen.width > 800) {document.location = "1024.htm";}//--></script> I need to do it in PHP not echoed to the document. fuzzy eg. <?if (screen.width > 800) {include "1024.php";}elseinclude "800.php"; Thanks. Link to comment Share on other sites More sharing options...
SFB Posted May 28, 2006 Share Posted May 28, 2006 I dont think php can detect the screen resoultion. it is a server side script. you should just use javascript. is there a reason you have to do it in php? Link to comment Share on other sites More sharing options...
scott100 Posted May 28, 2006 Share Posted May 28, 2006 Yeah php doesn't have access to that info, you could try something like this, javascript sends the info to a php page:Create index.htm; <script> var width = screen.width;var height = screen.height;window.location = 'index.php?width=' + width + '&height=' + height;</script> and in index.php $width = $_GET['width'];$height = $_GET['height'];if ($width> 800) {include "1024.php";}elseinclude "800.php"; Link to comment Share on other sites More sharing options...
reportingsjr Posted May 28, 2006 Share Posted May 28, 2006 no, you cant.. Link to comment Share on other sites More sharing options...
HalifaxPiper Posted June 3, 2006 Author Share Posted June 3, 2006 Thanks everyone for the input.My friend wanted to stay with the same frames themed site but with a database driven catalog. The resolution was needed to include PHP code based on table width.The photo album for example would show 4 thumbs across in 800 and 5 thumbs across in 1024. I took many peoples advice and pushed a single page down the SS pipe rather than a frames page. I lost the lightning loads but Meh... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now