Be a Supporter!

Screenwidth in php?

  • 307 Views
  • 4 Replies
New Topic Respond to this Topic
blah569
blah569
  • Member since: Jan. 18, 2005
  • Offline.
Forum Stats
Member
Level 25
Programmer
Screenwidth in php? 2007-05-20 17:57:54 Reply

I know how to do that in JS (screen.width), but how do I assign that to a php variable? Please help. Thanks.


BBS Signature
blah569
blah569
  • Member since: Jan. 18, 2005
  • Offline.
Forum Stats
Member
Level 25
Programmer
Response to Screenwidth in php? 2007-05-20 18:13:18 Reply

I solved it, but I have another question.

So, why doesn't this stretch the table to the width of my resolution? This is what I am using:

<table align='center' height='22' width='$width' cellspacing='1' bgcolor='orange'>
<td bgcolor='black'>
$width
</td>
</table>

It only fits the text, it doesn't stretch to my screen width.


BBS Signature
JeremysFilms
JeremysFilms
  • Member since: Feb. 18, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to Screenwidth in php? 2007-05-20 18:23:00 Reply

Just change width='$width' to width='100%'

And it looks like you're tryign to display the width too because you have:

<td bgcolor='black'>
$width
</td>

Just use the javascript there to output that.

authorblues
authorblues
  • Member since: Jun. 21, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to Screenwidth in php? 2007-05-20 18:51:38 Reply

At 5/20/07 06:23 PM, JeremysFilms wrote: Just use the javascript there to output that.

if youve already got the variable in memory, why not just use it there?
it would take more work to get it in php, and then get it again in js...

... kids!


BBS Signature
blah569
blah569
  • Member since: Jan. 18, 2005
  • Offline.
Forum Stats
Member
Level 25
Programmer
Response to Screenwidth in php? 2007-05-20 19:53:12 Reply

At 5/20/07 06:23 PM, JeremysFilms wrote: Just change width='$width' to width='100%'

And it looks like you're tryign to display the width too because you have:
<td bgcolor='black'>
$width
</td>
Just use the javascript there to output that.

Thanks, that 100% did exactly what I needed!


BBS Signature