Phalcon Volt - Multiple Inheritance

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Phalcon Volt - Multiple Inheritance



Is there any way to use multiple inheritance in PhalconPHP Volt?
I'd like to do something like that:


// index.volt

<!DOCTYPE html>
<html>

<head>
...
</head>

<body>
% block content %% endblock %
</body>

</html>



Next:


// layout.volt

% extends 'index.volt' %

% block content %
<div class='header'><div>
% block actionContent %% endblock %
<div class='footer'><div>
% endblock %



And then:


// actionView.volt

% extends 'layout.volt' %

% block actionContent %
Lorem Ipsum
% endblock %



It doesn't work because of Embedding blocks into other blocks is not supported...


Embedding blocks into other blocks is not supported...



I very want resolve this problem. Is it possible?





No it's not supported. Use macros and partials for code re-use.
– yogur
Aug 30 '17 at 11:36





2 Answers
2



This is not supported yet. But over on Github I see there are two tickets open for this issue:



[VOLT] Support for embedding blocks into other blocks



https://github.com/phalcon/cphalcon/issues/329



Volt parser embedding block error



https://github.com/phalcon/cphalcon/issues/12846



Might be a good idea to bump one of those issues to see if there has been an update.



The only way I see here is instead of extending parent volts, you can include the children. That is supported.


// layout.volt

% extends 'index.volt' %

% block content %
<div class='header'><div>
% include 'actionView.volt' %
<div class='footer'><div>
% endblock %



and


// actionView.volt
Lorem Ipsum






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS