Phoenix.View
Phoenix.View
Defines the view layer of a Phoenix application.
This module is used to define the application main view, which serves as the base for all other views and templates in the application.
The view layer also contains conveniences for rendering templates, including support for layouts and encoders per format.
Examples
Phoenix defines the view template at web/web.ex
:
defmodule YourApp.Web do
def view do
quote do
use Phoenix.View, root: "web/templates"
# Import common functionality
import YourApp.Router.Helpers
# Use Phoenix.HTML to import all HTML functions (forms, tags, etc)
use Phoenix.HTML
end
end
# ...
end
We can use the definition above to define any view in your application:
defmodule YourApp.UserView do
use YourApp