How to simply load an internal view in a phoenix framework?

I use Elixir in a phoenix framework. We know when we invoke an action in a controller, the framework renders a complete view that includes a footer, an internal view (main content) and a header. How to load and display only a view without a header, view a footer?

Example: localhost: 4000 / posts / new -> We will have a header, form and footer

local: 4000 / record / 1 -> We just show the contents of message # 1 with no header and footer.

Thanks,

+6
source share
1 answer

You need to use Phoenix.Controller.put_layout(conn, false) in the controller action function to disable layout rendering, e.g.

 def show(conn, _params) do conn |> put_layout(false) |> render("show.html") end 
+11
source

All Articles