Conditionally render templates in Phoenix - Elixir
Sometimes in a Phoenix Framework project, you want to conditionally render a template. Why not just use a "cond" or "case" or a bunch of "if" statements?
Well, i'm lazy, is the short answer.
But the long answer is that i want to just add new templates, which is just like adding new functionality. And if I don't have that functionality, I just drop back to a default EEX template.
The handy "render_existing" function handles this very well, but it's not so obvious in the documentation.
And there you have it. Simple conditional template rendering in Phoenix Framework.
- How much of the "Programming Elixir" book must I go through before I can start learning Phoenix?
- What popular or emerging web applications are built with the Elixir language and Phoenix framework?
- How do I learn Phoenix (Elixir) in a pleasant way?
- Is it possible to build an eCommerce website with Elixir and the Phoenix framework?
- Is Elixir + Phoenix worth learning when you have to create very quickly web backends that scale to millions of users?
- How mature is Elixir?
- Is Elixir (programming language) dying?
- As a Ruby programmer, why do you choose Elixir over Crystal or vice versa?