blset

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

josevalim

Creator of Elixir

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

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

josevalim

Creator of Elixir

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.

Where Next?

Popular in Discussions Top

Donovan
Hello everyone, I’m so glad to have discovered this awesome community. Thanks for creating it! This is my second post, and apologies for...
New
WildYorkies
It seems that the more I read, the more I find Elixir users speaking about all the ways that Elixir is not good for x, y, and z use cases...
New
Fl4m3Ph03n1x
Background This question comes mainly from my ignorance. Today is Black Friday, one of my favorite days of the year to buy books. One boo...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31265 143
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
New
jer
I’ve been using umbrellas for a while, and generally started off (on greenfield projects at least) by isolating subapps based on clearly ...
New
ben-pr-p
In general I’ve been sticking to this community style guide GitHub - christopheradams/elixir_style_guide: A community driven style guide ...
New
pdgonzalez872
If this has been asked here before, please point me to where it was asked as I didn’t find it when I searched the forum. Maybe a mailing ...
New
Owens
Hello all, I am developing a new mobile app with Flutter frontend and Phoenix backend. The mobile app has real-time task management and c...
New

Other popular topics Top

siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41989 114
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement