PHP itself works only on server side and does not know anything about client system
to gather required information of the current client environment like window size is unavoidable
I presume the inner window width is required, because this is the client width
determining the design of the content.
. This is a standard property, see http://www.w3schools.com/jsref/obj_window.asp
To avoid incompatibilities, I would use jQuery
. It's important not to forget round brackets at the end, as in jQuery this is a function.
The server side can get this information in different ways; the selection of the method should depend on the design and logic of your application. It could be sent as a form submission, AJAX or URL parameters.
At last what is the professional suggestion? (js-php or some better way?)
Lots of thanks. [OP's grammar/spelling/capitalization fixed — SA]
First, please don't post a solution, unless this is really a solution. In all other cases, use "Improve question" above, add a comment or reply to existing comment.
So, what could you do. I would say, use more simple and reliable HTML/CSS design. Imagine you only use paragraphs and headers, tweak only the font styles and margin/padding styles, no absolute positioning. Will it be screen-size independent? Yes, pretty much. Such format is fluid, it will adopt to screen size itself. Likewise, you can all a lot more formatting in such device-independent manner and still be able to achieve quite a rich UI. Just keep it in mind and permanently test on different windows sizes, simply resizing your browser window.
As a free bonus, such design will be highly tolerable to browser incompatibility. And don't be afraid to be not enough impressive to the users.
Most reasonable people were already fed up with beefed-up "cool" design. People would be more happy with highly readable and functional design, not highly graphical puzzles.