KarterJK wrote:I am still confused as to why the $screenwidth is not a viable php variable? The content is stored in $screenwidth, why then can I not use it for a comparison check? That loses me.
To me its just like a variable submitted by a form to a PHP process.
PHP is a server-side technology -- all of the processing is done on the server. JavaScript (JScript, ECMAScript, et al) is a client-side technology -- all of the processing is done on the user's machine after the page is downloaded. When a user's browser requests a PHP page, the script is run on the server and then sent to ther user. By the time the user's browser recieves it and has a chance to process the JavaScript, the PHP processing is already done and there's no way that that PHP can access values that are the result of the JavaScript code.
Do me a favor and run the code you posted above in your browser. Now go up to View > Source. You'll see that the output of your script is
not this:
- Code: Select all
10241024no
Rather, the output of your script is this:
- Code: Select all
<script language="Javascript">document.write(screen.width);</script>1024no
At no point is PHP even the slightest bit aware of the value that your JavaScript outputs.
Now, then, if you're using frames, why not just use JavaScript (skip the PHP) to write the contents of the frameset? I won't post example code, as I loathe frames.
And I still think this is a bad idea. Unless you're writing a web app like
Oddpost or something and can justify resolution-dependent layouts, it's a far better strategy in the end to make a single design that works equally well regardless of resolution.