So I checked the definition of Phoenix View
render_layout function and I would like to write something similar to pass multiple blocks to render into differents parts of my layout template. Here is the function I writed in my layout view module:
def render_banner(assigns, left: left_block, right: right_block) do assigns = assigns |> Map.new() |> Map.put(:banner_left_content, left_block) |> Map.put(:banner_right_content, right_block) render("banner.html", assigns) end
But now I don’t know how to use it inside my templates.
I would like to do something like:
<%= LayoutView.render_banner assigns do %> <% :left %> <h1>TITLE</h1> <hr> <% :right %> <img src="/images/img.svg"> <hr> <% end %>
I don’t want specifically this syntax, just anything that would be enough readable.
Please can you guide me to implement this?