We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Responsive Website with Server-Side Enhancement

I'm trying to build a responsive website with server-side enhancement in Phalcon.

In this approach, I'm detecting user's device at server side with Mobile-Detect library. Based on the device type I want to enable/disable certain components and modify the HTML markup.

To achieve this I'm thinking to use two different directories which will have all view related files - one for Mobile and another one for Desktop. Then in the PHP code, while creating view service for DI, I'll set the the view directory path based on detected device.

I would like to know if the above approach is good or not ? And whether there will be any performance overhead because of this ?

If there is any alternate solution to build responsive website with server-side enhancement in Phalcon then please let me know.

If it works it's a good solution. And this will work.

I think it was a good design. However, the trade-off would be having a lot of views template and maintain all of them.