Phoenix.View.render
You're seeing just the function
render
, go back to Phoenix.View module for more information.
Renders a template.
It expects the view module, the template as a string, and a set of assigns.
Notice that this function returns the inner representation of a
template. If you want the encoded template as a result, use
render_to_iodata/3
instead.
Examples
Phoenix.View.render(YourApp.UserView, "index.html", name: "John Doe")
#=> {:safe, "Hello John Doe"}
Assigns
Assigns are meant to be user data that will be available in templates. However, there are keys under assigns that are specially handled by Phoenix, they are:
:layout
- tells Phoenix to wrap the rendered result in the given layout. See next section
Layouts
Templates can be rendered within other templates using the :layout
option. :layout
accepts a tuple of the form
{LayoutModule, "template.extension"}
.
To template that goes inside the layout will be placed in the @inner_content
assign:
<%= @inner_content %>