Results 1 to 2 of 2

Thread: Best Practices for Integrating PHP

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Vote Rating

    Default 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:
    There are many pages in this app where values are retrieved from PHP using a hybrid type of page. In other words, a page for a view may be called: "view.js.php", with the Content Type set to "application/Javascript".
    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:
    1. 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.
    2. 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"?
    I could be wrong about this - I am very new to Sencha - so would appreciate some input from more seasoned Sencha developers.

  2. #2
    Sencha User grgur's Avatar
    Join Date
    Aug 2007
    Split, Croatia
    Vote Rating


    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)
    <div style="float: left; width: 70px;"></div><div style="float: left; height: 100px;">Grgur Grisogono
    Ext JS in Action SE co-author
    Exercising awesomeness at Modus Create - Official Sencha Partner

    Get in touch for Sencha Touch Training
    @ggrgur</div><div style="clear:both;"></div>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts