theshank
Is there any inbuilt functionality for providing template inheritance for eex templates, something like jinja2 has (in the Python world).
PS: this is my first web application in elixir and I am trying to build it without phoenix.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 9 to 1- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
lud
Unfortunately the blog is not online anymore. Could you tell me the basics of the solution?
Btw I found this : Bash-Shell.Net - Phoenix for Django Devs: The {% block %} Tag
theshank
@amarandon sorry I didnt log into elixirforum for quite some time… Are you still facing this issue?
amarandon
I’m interested in this but is it up-to-date? I couldn’t compile it:
themarlzy
Enjoyable read, thanks for sharing. Helps solidify the knowledge of how eex works
theshank
To those who come to this topic, please check out the last portion of this blog post. You can build a solution on those lines.
Thank you @NobbZ for the help.
theshank
Thank you for the pointer, I will write some wrapper functions in line with this and see how it goes.
NobbZ
The easiest might be to simply have an outer template, which has some assign for the inner content, then have many templates for the inner content.
Then roughly do
assigns |> render_inner() |> &(Map.puts(assigns, :content, &1)).() |> render_outer().Yupp, I did not understand anything, except, that the current template shouldn’t know about anything from the outside.
By doing something like your
extendyou basically couple those templates. Swapping designs on the fly will be a hard thing, while still easily possible with my aproach above.Also changing the title of the page shouldn’t be done by the inner template. It is meant to just display the data. The “controller” is the entitiy that is aware of the full context, and therefore should assign a title. And only the rendering stage should then decide if a title is needed at all (perhaps we are rendering in a desktop application and do not touch the window title here?)
theshank
The requirement is to have the common parts (like the
<html>,<head>etc. ) and then have separate .html.eex files for body contents for various pages (index, about etc.). If its not too much, can you please guide me as to how I should go about this…Well you are right, not many here will be familiar with it. Basically in the derived templates, you just put a
extend "base.html"tag at the top. The library would then inject the base html contents here. Also they have concept of content blocks. So you could define a “navigation” content block inside the<body>tag inbase.htmland then if you specify that content block in any derived template, it would replace the default contents for that particular content block before generating the final html. I understand I am not making much sense here, so I will stop hereYes actually ! I am using Plugs for creating the application. The only reason for not going for Phoenix straight-on is that its code contains a lot of macros and I am not really comfortable reading and then making sense of that much macro code. I see that its a beautifully designed framework but I was hoping of starting small.
NobbZ
Currently not, and I do not think it should be part of it. There are many different ways to compose templates, and currently you can implement a small wrapper around the way you prefer most.
How do they do it? Only a minority of the community has used python and even less will have used that library.
What do you use instead? Pure plugs? Or are you talking HTTP directly? Do you have any reasons for this?