anthonator

anthonator

Views/Templates without Phoenix

I’m sure this has been asked a thousand times but I’m having trouble finding anything.

We currently have a project that doesn’t use Phoenix but does need template/view support. I haven’t found any standalone libraries that provide this functionality but figured I may just not be using the right keywords. I’ve looked through Phoenix’s implementation of templates and views and it seems relatively straight forward. If nothing exists and this is something the community is interested in I could implement something and open source it myself.

Thanks in advance!

First Post!

pdgonzalez872

pdgonzalez872

@anthonator hi!

With the tradeoff of being “that guy”, similar to you, maybe you have been asked a thousand times, but I don’t know about all those times… :slight_smile: but: is there any way you can move the current project inside a new phoenix app? I understand this may not feasible.

But, as you just saw, it is awesome to be able to search for decent results, to be on the same page as others that, in this case, all use Phoenix.

Sorry to be that guy, hope you are having an awesome day @anthonator :heart:

Most Liked

LostKobrakai

LostKobrakai

I’m wondering what part of Phoenix do you actually need over plain EEx?

bryanjos

bryanjos

As @LostKobrakai said, EEx comes with Elixir itself. If that gives you what you want

anthonator

anthonator

Here’s what I’ve come up with for now.

defmodule MyApp.Views.PasswordReset do
  require EEx
  
  @root "lib/myapp/templates/password_reset"

  EEx.function_from_file(:def, :request, Path.join(@root, "request.html.eex"), [:assigns])
end

Last Post!

OvermindDL1

OvermindDL1

That’s basically all phoenix does. ^.^

Where Next?

Popular in Questions Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New

Other popular topics Top

gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
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
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
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

We're in Beta

About us Mission Statement