I'm using Elixir in Phoenix framework.We know when we call an action in controller, the framework render a full view that includes footer, inner view ( main content) and header. How to load and render just a view without header, footer view ?
Example : localhost:4000/posts/new -> We will have header, form and footer
localhost:4000/post/1 -> We just show content of post #1 without header and footer view.
Thanks,
You need to use Phoenix.Controller.put_layout(conn, false)
in your controller action function to disable rendering the layout, e.g.
def show(conn, _params) do
conn
|> put_layout(false)
|> render("show.html")
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With