blset
@view_template meaning changed in phoenix 1.5
the @view_template variable as accessed in the app.html layout of a 1.4 phoenix app contained the name of the template being rendered by the controller
in phoenix 1.5 I get root.html, the name of the new template, first in the chain, under a live setup
how to recover the name of the template being rendered (information needed in the root.html layout )?
Marked As Solved
josevalim
For the @view_module and @view_template, use view_module(@conn) and view_template(@conn) instead. Note you will need to import view_template: 1 in your my_app_web.ex file under def view.
Also Liked
blset
according to the docs https://hexdocs.pm/phoenix/Phoenix.View.html
The following assigns are reserved, and cannot be set directly:
@view_module- The view module being rendered@view_template- The@view_module's template being rendered
but when I serve a template mytemp.html from a controller Mycont @view_template does not contain mytemp but only root.html @view_modules contain LayoutView
previously in 1.4.6 we had @view_template mytemp.html and view_module MycontView
so how od you get the name of the template being rendered in @inner_view ? which should be mytemp.html ?
josevalim
Btw, it is not that the meaning changed, they are the same for app.html.eex, but root.html.eex has a different interpretation of those.
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









