Double extend in Volt view

Hello!

I'm working on some application and I would like to have a little bit more dynamic layout of Volt file. I'm using partials for header, navigation and footer. Instead of writing divs for widgets (widgets are just elements around content like <div class="space"><div class="widget">[content]</div></div>) I would like to use more extends in one Volt file, to achieve the same effect. So instead of writing those divs, I would just write extends and block where I need to put the content.

After looking to the documentation the nearest thing are partials, but then I cannot put a lot of content in it without creating variable and putting html in php string. It is possible to do what I think without much work?

Thank you for help! :)



20.4k

Just do a template that extends from a template that extends from a template, and so on. That's the easiest way I have in my project.

edited Nov '14

Yes, that is some kind of solution but I am looking for better way than that. In other markup languages along frameworks, there is possibility to call more extends inside one file, so I believe that Volt could also do that.

Is there any other way than already suggested?



20.4k

I don't remember if Volt allows multiple inheritance, but you can try it. Just write more than one {% extends %} and tell us.

Extends statement must be placed at the first line in the template in [file] on line [line]

That's why I created this thread :)



20.4k

And that's why I answered you that. I just know that the nearest thing is a recursive extending. @phalcon will answer you better.