Question

I've been looking into EJS and JavaScriptMVC. I see quite a bit of value through JVMC's controllers and their models (in some cases, namely 3rd party rest integration). However, I develop in PHP using a traditional MVC such as Zend.

Typically for working with Ajax, I'll set it up just as I would any other page (model/view/controller), however instead of rendering the view, I'll return it, json_encode it and echo it out. Such as this:

echo json_encode($this->View->render('View_Name', true));

This view will have already been passed data, done it's thing, and is now returning fully rendered in a JSON object I can work with in JavaScript.

This seems simple enough. So, with this type of setup, what is the benefit of using something like EJS?

It appears I would now have to not only define a new file for a view, but also continue to use the same controllers and spit out JSON instead of just the rendered view. That JSON would then contain the data used for the EJS view. Am I missing something?

Thanks!

Was it helpful?

Solution

Its hard for me to see a benefit with EJS unless you can use templates multiple times in your application, which is not always the case. I also program in PHP and have tried several JavaScript frame works. If I'm making a simple application I just stick to JQuery, but I think the best framework to work in is ExtJS: http://www.sencha.com/

When you define your different objects the view is created for you using a default template. You can also add a different look and feel to each of the objects and switch back and forth between multiple templates. The browser support is awesome and it really makes for building a great application. Take a look, tell me what u think...

The latest version uses MVC application architecture: http://www.sencha.com/products/extjs/whats-new-in-ext-js-4/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top