Screen Resolution

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Screen Resolution

Post by s.dot »

I have a banner that's messing up my table widths in 800x600 resolution. Since I use 1024 x 768, I didn't notice this until recently.

I've googled the problem, and all I can find are javascripts that write PHP lines of code, which confused the hell out of me because I'm not familiar with javascript.

What I would like to do is use a full banner if screen resolution >= 1024 x 768, and use a half banner if the screen resolution < 1024 x 768

Is there a way to do this using only PHP?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

no.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

nope thats javascript. im having some problems with a semi-similar problem but i think this code mite be somtin you can use

Code: Select all

<script language=&quote;JavaScript&quote; type=&quote;text/JavaScript&quote;>
var winW = 630, winH = 460;

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName==&quote;Netscape&quote;) {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf(&quote;Microsoft&quote;)!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}

document.write(
 &quote;Window width = &quote;+winW+&quote;<br>&quote;
+&quote;Window height = &quote;+winH
)
</script>
also, iv been having trouble getting this to work in IE. I didnt write it i got it off some website somewere but it outputs the users screen resolution so you can then base your banner size off of the results...probebly some more javascript
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

there's a screen object for the data..
Post Reply