S
S
Stepan2015-09-02 00:51:52
PHP
Stepan, 2015-09-02 00:51:52

Is it good practice to render half of the page in PHP and draw the rest using JS templates?

For example, I want to make a side menu as a nested layout and not bother with its rendering in JS.
But to draw the central pieces already with the help of JS, since for different users they can be different.
Well, having accordingly switched to a new tab, draw the side menu and external layout again through PHP.
And everything else through js in the central block (reason: a lot of small calculations, animation and galleries)
Changes are saved in the database by submitting Ajax
Is it worth bothering at all or doing everything in PHP or in JS
03652e22224e449794c8b87854133741.png

Answer the question

In order to leave comments, you need to log in

6 answer(s)
M
Mariik, 2015-09-23
@xoma2

In principle, it is normal, but only for dynamic sections of the page.

H
hime2, 2015-09-02
@hime2

Asynchronous loading, it's called. Yes, good)

A
Alexey Lebedev, 2015-09-02
@swanrnd

Bad practice.
Normal:
- render everything that the user sees in PHP.
- then hang all events.
Between PHP and JS abyss on time.

A
Alexander Wolf, 2015-09-02
@mannaro

If on a subject, then: this practice is quite popular. You can safely use it.
Aside: try meteor;) And there will be no such questions. It is great for a dynamic responsive website.

E
Elizaveta Borisova, 2015-09-02
@Elizaveta

You can do whatever you want, there are no restrictions, within the working options. It is clear that in this scenario, the application is not a SPA in the strict sense.

I
IsaevDev, 2015-09-02
@IsaevDev

You can send all ready-made layouts from php as js variables. And already js will display them on the screen. I think this will give more flexibility to the client side.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question