Hi
I was wondering, if something speaks against implementing inheritance in
macro templates. I did some basic proof of concept, but have to
investigate further, it seems too easy and there must be a catch
somewhere :)
What I basically like to have is the following
index.html.twig
****
{% extends "HelloBundle::layout.html.twig" %}
{% import "::macro.html.twig" as some %}
{% block content %}
{{ some.func() }}
{{ some.otherfunc() }}
{% endblock %}
****
macro.html.twig
****
{% extends "::macrobase.html.twig" %}
{% macro func() %}
This is a func of macro.html
{% endmacro %}
****
macrobase.html.twig
****
{% macro otherfunc() %}
This is a otherfunc of macrobase.html
{% endmacro %}
{% macro func() %}
This is a func of macrobase.html
{% endmacro %}
****
So I can overwrite some functions of a macro template, but inherit
others which I don't want to overwrite.
This would allow me to reuse macros in more places, without having to
import too many macros with different aliases.
What do you think? Or is there already a way to do this in twig?
chregu
--
Liip AG // Feldstrasse 133 // CH-8004 Zurich
Tel +41 43 500 39 81 // Mobile +41 76 561 88 60
www.liip.ch // blog.liip.ch // GnuPG 0x0748D5FE
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en