Elixir Phoenix.View.render_to_字符串如何使用布局渲染模板?

Elixir Phoenix.View.render_to_字符串如何使用布局渲染模板?,elixir,phoenix-framework,Elixir,Phoenix Framework,模板的渲染效果良好: html = Phoenix.View.render_to_string(MyApp.BillingView, "receipt.html", %{organization: organization, transaction: transaction}) …但我想用布局渲染此视图。如何实现这一点?解决方案:Phoenix.View.render_to_string(MyApp.BillingView,“receipt.html”,[organization:organi

模板的渲染效果良好:

html = Phoenix.View.render_to_string(MyApp.BillingView, "receipt.html", %{organization: organization, transaction: transaction})

…但我想用布局渲染此视图。如何实现这一点?

解决方案:
Phoenix.View.render_to_string(MyApp.BillingView,“receipt.html”,[organization:organization,transaction:transaction,layout:{MyAppWeb.LayoutView,“receipt.html”},conn:conn])
我没有分配@conn.Welcome到这个网站!如果你自己解决了问题,请用实际答案自由回答你自己的问题。它对未来的人们更有帮助,评论不是回答问题的地方。此外,是一个伟大的资源,以更好地了解网站如何工作!