D
D
Delphinum2015-10-19 21:56:59
Smarty
Delphinum, 2015-10-19 21:56:59

Should PHP-level templating be mixed with JS-level templating?

People, welcome.
In my current activity, I actively use the ZF + Smarty bundle, but my soul lies more with one-page sites based on Backbone. Why it became interesting, is it possible to combine this approach?
Ideally I would like the following:

  1. The site is divided into basic pages, the transition between which is carried out with a reload
  2. Widgets are embedded on each page, which, using the RESTful API, request data from the server and render components using Backbone
  3. Interaction with components is carried out without reloading the page
  4. Complete separation of HTML / PHP / JS / CSS through the use of template engines and templates connected to the page

In principle, it is quite feasible (even implemented in a test project), but I wonder if there are any ready-made solutions to this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JustRoo, 2015-10-20
@JustRoo

I have never worked with Backbone, so I may not understand some fundamental things, keep this in mind.
I once tried to do something similar, but came across a number of rakes. The main rake is storing the states of the components (and bringing the components to the required state). It turns out that either you are limited to stateless components, which is not always enough, or you store the state of the component in the URL, but then there is a conflict between the components on the same page and God bless you if you suddenly decide to conjure with this through the HistoryAPI, or you try to save the state of the components somehow else and build your own bike with all the consequences. The second problem is the isolation of components and, conversely, the exchange of data between them.
In fact, it all depends on what you need from the components. The less logic they have, the more feasible this scheme.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question