30 Oct 2012 3:25 PM #1
Unanswered: Best Practices for Integrating PHP
Hi all. New member. I've been tasked with taking a Sencha 1.1 application, and migrating it to 2.0.
As I've been researching for the last few days, something has begun to concern me more and more:
The thinking is that they can then just retrieve values and settings via the php page, and "inject" the values into the page with "<?php echo ....?> tags.
Is this a good practice? My gut feeling is that it's not a good idea for the following reasons:
- Fundamentally, isn't the premise that Sencha is a client-side application - encouraging separation from the server side? I would have assumed that the application runs on the client, and calls (such as JSON queries), are made to retrieve data/configuration variables.
- Does this preclude the advantages of Sencha 2's ability to only instantiate/load classes as they are needed because it is looking for "view.js" for example, in the views directory, rather than "view.js.php"?
31 Oct 2012 2:24 AM #2
It's a good question and you're not the only one asking about integrating client side app with server side. Some do it for the sake of performance, some due to better familiarity with PHP than JS, and some are just trying to invent hot water. Let's just say that all of the above yield questionable results.
I understand that there are so many considerations in your particular case, but at the end of the day, you will certainly benefit from doing everything by the book. That means to separate client and server side and have them communicate through JSON objects. As with all other technologies, sticking to the best practices and coding conventions will pay off in the long run (I would say in the short run, too)