Answer the question
In order to leave comments, you need to log in
Should I use EJS on the server using PHP?
We are talking about a REST-like MVC web resource architecture, in which EJS acts as a template engine . It's easier to show an example than to explain the details:
In response to a request http://example.com/categories
or, for example, the http://example.com/posts/100500
server will send to the client text/html
, and in response to http://example.com/categories.json
and http://example.com/posts/100500.json
- application/json
. Accordingly, in the first case, the template is processed on the server, and in the second case, directly on the client. Let's say we feed all internal links with the event onclick
, and the once-written callback function makes an AJAX request and updates the DOM using our template engine and the same template file in the client browser.
If we are writing in node.js this would be a stupid question, but we are writing in PHP and is it advisable to use PHP's V8 implementationto create this architecture is a reasonable question.
Here are my thoughts on this:
Answer the question
In order to leave comments, you need to log in
And what's the point of processing the template on the client and on the server, if you can process it only on the client or only on the server?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question