Reputation: 2177
I have been developing a application for 8 months now that has been utilizing Smarty for PHP templates.
I have had no problems at all with Smarty, and I have started to add more JavaScript interactions for the users on the site.
I was thinking of using backbone.js to template the JavaScript as well.
But another thought came to me, would it be bad idea to return a smarty template and load it in the div rather then return a json and use backbone.js to format the results?
Would this slow the application in anyway? What are the benefits (if any) and disadvantages to doing this?
Any thoughts would be great,
Thanks
Upvotes: 4
Views: 777
Reputation: 35790
With a normal multi-page "web site", users navigate from page to page consuming the site's features. Backbone however works best with a single-page "web application" model. With this approach, the only html page loaded is the first one; after that, every "page transition" is actually handled by Backbone's Router, which fakes page transitions dynamically via DOM manipulation. Each new page's elements are in turn built out of Backbone Views; PHP-generated html is never involved.
And that's why Backbone may not be the best fit for you. Unless you want to change your PHP code to be purely a server-side API-style structure (which wouldn't really need Smarty), much of Backbone's value is going to be lost.
Upvotes: 3