Function StonksLiveWeb.html/0 is undefined or private. StonksLiveWeb is missing the html function

I’m following this tutorial to learn phoenix. However, it seems like the function “html” is missing from stonksLiveWeb_web.ex file and so I’m unable to call this: “use StonksLiveWeb, :html”

defmodule StonksLiveWeb.HelloController do
use StonksLiveWeb, :html

def index(assigns) do
~H"“”
Hello!
“”"
end
end

Blockquote

Please advise on how to get around this. :pray:

Which version of Phoenix do you use?

:html is for projects generated for Phoenix >= 1.7. Before, that it was :view.

You need to upgrade (phx_new archive in particular) to generate a Phoenix 1.7 project or to follow the guides for the version you actually use.

PS: I don’t really get your mix between controller and view stuffs.

1 Like

Yes it’s because of a version mismatch. I was following the latest guide for Phx 1.7.2 when my project is at 1.6.2. Hence the confusion. It is resolved thank you for helping. :pray:

2 Likes