Using Smarty or Backbone.js for javascript templates

I have been developing the application for 8 months using Smarty templates for PHP.

I had no problems with Smarty, and I started adding more JavaScript interactions for users on the site.

I was thinking about using backbone.js for a JavaScript template.

But another thought came to me: would it be a bad idea to return the smarty template and load it into a div, and then return json and use backbone.js to format the results?

Will this really slow down the application? What are the advantages (if any) and disadvantages for this?

Any thoughts would be wonderful

thanks

+4
source share
1 answer

With the usual multi-page β€œwebsite”, users navigate from page to page using site features. However, the baseline works best with the one-page web application model. With this approach, the only html page loaded is the first; after that, each "page transition" is actually processed by the Backbone Router, which dynamically rebuilds page transitions using DOM manipulation. Each new page element, in turn, is built from Backbone Views; PHP-generated html is never involved.

And why Backbone may not be right for you. If you do not want your PHP code to be a pure server-side API-style structure (in fact, that would not require Smarty), much of the value of Backbone will be lost.

+3
source

All Articles