View provides client side templates. Typically they work with controller to render data in HTML form.
Typically, you should not be creating and rendering a view with MVC.View, you should be using
MVC.Controller.render to create and render templates from your
controllers.
Install
include.plugins('view') //for basic templating functionality
include.plugins('view/helpers') //for HTML helpers
Including views
MVC can package processed views in the production file. After including the include plugin, you
can use include.views wrapped in an include callback function. Because included views are already
processed, they don't rely on eval. Here's how to include them:
include.plugins('view','controller')
include.controllers('tasks');
include(function(){
include.views('views/tasks/show');
})
Read more about
include.views.
View Helpers
View Helpers create html code. View by default only comes with
partial and
to_text.
You can include more with the view/helpers plugin. But, you can easily make your own!
Learn how in the
Helpers page.