M
M
Mikhail Abroskin2016-04-15 20:25:51
PHP
Mikhail Abroskin, 2016-04-15 20:25:51

What is better to choose for solving a specific problem, php or js?

There was a problem, in principle, simple and the question is not actually in the solution, but in what kind of "hammer" to choose to hammer this "nail" ...
The task is to make a component for Bitrix: events and news about them). I actually started with the output of the calendar and in the morning I decided that I would generate the calendar using js on the client side, by the evening, not particularly in a hurry, I almost finished with the implementation of the client part and then .... it began to seem to me that the calendar is much better it would be nice to generate it on the server side using php, since the calendar page is static and does not have any active elements, except for links and tooltips ...
And then I was stuck on what to choose php or js, if the issue can be solved this way and So?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
B
bro-dev, 2016-04-15
@xPomaHx

compose statics, get json data and fill in js - a modern version.

S
Sergey, 2016-04-15
Protko @Fesor

The task is to make a component for Bitrix

So, we can no longer get rid of php
We draw conclusions. Perhaps you will want to attach some kind of dynamics (leaflet), etc. later. You never know.

D
Daniel Khaliulin, 2016-04-15
@khaliulin

I agree with Sergey Protko .
JS for the client side (with ajax, for example), and php for delivering data as a "backend".

M
Mikhail Abroskin, 2016-04-15
@miker059

So the fact of the matter is that there will be no dynamics, you just need to generate a calendar, from the given initial and final months, broken down by years, if the range is extended for several years. This can be done both in php and js, in principle, I have already implemented it in practice anyway, it seems to me the variant in php, in terms of rendering speed it will be faster, because. we get an already generated page from the server and we don’t need to generate anything on the client side ... although I don’t notice much difference yet ...
As a result, after thinking, with a fresh mind, I chose PHP, namely the calendar generation process and its rendering. The choice is justified by the fact that, in this case, we do not use the client's resources for rendering, plus the page with the calendar will be cached on the server by Bitrix, which will also speed up the return speed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question