OK, this may sound like an odd request, but hopefully someone can help.

I have always developed scripts behind webpages that were 800 wide so they would fit on basically any display.

The one I'm working on now I have designed for 1200 wide because I just needed more space.

Basically my question is this:
Is there any way using PHP to force a ctrl/- if I detect that the resolution of the screen that it is being displayed on is too small to fit the full width on it?

I'm assuming that everyone knows that holding the control key down while pressing the - key or the + key adjusts the resolution of the monitor (at least that is what I assume is going on)

I would just like to make it happen automatically through the script, if it is deemed necessary.

Any feedback on this would be greatly appreciated.

Thanks
Douglas

Member Avatar for diafol

Sounds like you want responsive web design (RWD) Doug. Javascript and media queries are the way to go IMHO. Have a look at some sites like Twitter Bootstrap - I've been using this quite a bit recently. With a myriad of different resolutions available from teenymobs to size-of-a-cow monitors, it becomes very difficult to provide for each outcome. So, to overcome this, set a few breakpoints. TB uses these I believe:

Large display - 1200px and up
Default - 980px and up
Portrait tablets - 768px and above
Phones to tablets -767px and below
Phones - 480px and below

Thank you for that response diafol... That may be the answer ultimately to the issue.

I was hoping that someone could tell me how to initiate the ctrl/- if the resolution is under 1200...

I don't really plan to be concerned about tablets and phones... More or less just laptop and desktop monitors.

But I will do some studying on that Twitter Bootstrap.

In the meantime, any quick and easy solution would also be appreciated...

Thanks again for your help
Douglas

Member Avatar for diafol

I think you need to look at javascript instead of php. There may be some php class out there, but I can't see how the server would know the resolution without the client telling it. Browsers used to pass res in the headers, but I think this was dropped a good while ago.

OK, thanks again for your response... I will look in that direction.

Javascript is not one of my strong points... LOL. But I 'm learning slowly.

Going to mark this solved so I don't forget, but if I don't find the solution, I may be back to ask more questions...

This has become my go to place when I am stumped, and I almost always find what I need.

Thanks again,
Douglas

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.