Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to just load inner view in Phoenix framework?

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,

like image 745
Cuong Ta Avatar asked Oct 29 '15 07:10

Cuong Ta


1 Answers

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
like image 135
Dogbert Avatar answered Oct 01 '22 23:10

Dogbert