With inheritance of multiple files like a.volt extends b.volt extends c.volt, I have to use embedding blocks. Otherwise there's no profit to use inheritance more than one nesting level.
The same question. Is there a plans to implement this feature?
Greetings!
Is there any plans to implement this feature?
Hi, is there any plans? I think this feature is important.
+1
I upvote for the feature
Agreed. It would be nice to have a block inside an if statement.
I think it's very useful feature. Waiting for this!
Actually this is why i'm using twig instead of volt
+1 for this great feature
Any improvements after almost a year? As for me, this is the most needed missing feature in Volt
This will be implemented in Phalcon 2 with Zephir
At this moment, Phalcon 2 is missing some features from 1.x and still not stable enough for using in production. Why don't you fix this bug in Phalcon 1.3.3?
+1 to implement this feature in 1.3.x
It seems, developers are focused only on 2.x branch and will not implement any new features in 1.3. Anyway, this wasn't implemented for 1.5 years so... You can use Twig if you need this feature.
@phalcon told
This will be implemented in Phalcon 2 with Zephir
Just curious, when will Phalcon 2 be released?
So the reason not to use Twig or Smarty is that I suppose Volt is considerably faster in compiling templates since I suppose that the engine is written in C. And it seems that the compiled code is pretty clean too...
However, template inheritance screams for nested blocks... you can hardly live without these.
Plus One for nested blocks (and verbatim and block-plugins)
And i use twig because I assume that the template are cached once they are parsed ;)
+1 We need it so bad!
I have moved to Twig completely for rendering templates. It's more mature and has better docs.
Hi guys, do we have some updates for this feature?
phalcon commented on Jan 14, 2014
This will be implemented in Phalcon 2 with Zephir
Any news on this one? Definitely needed.
I am developing current project with volt, just ran into the problem. Now I have to decide if I want to re-write all views in twig/smarty. Only two weeks from the deadline now.
@reedgz I'll be addressing this soon
@andresgutierrez Thanks man. I am still developing with volt; just used some include to work around the problem. Fortunately my views are relatively simple.
Nothing at all?
I switched to Twig as well...
I wonder why Phalcon team created VOLT, which causes a lot of troubles for framework users. Twig's mature and performance are too great (templates are compiled to php, then it will be cached by Zend Opcache + add-on Twig C extension).
What happens if Phalcon team drops Volt to improve project's development speed?
@redstrike "A LOT OF TROUBLES" "TOO GREAT"
I need this feature as soon as possible! please, it's a shame that this magnificent framework doesn't have something so important. Thanks
up
Can't we work with Twig until its implemented? Need this indeed.
yes, Twig our saver but it's not a good solution at all ((
Could the need for nested blocks be solved by using nested partials?
True inheritance implies that it should be possible to inherit not only one level deep but infinite levels deep. This enables writing templates that complete parent templates or even only partially complete parent templates. It is a great feature for template inheritance such as implemented by Twig and Smarty3. To make inheritance work you need to have multiple nested levels and Volt just does not provide that.
That said: you can make up any template with Volt, and use one level deep inheritance, but multilevel inheritance is much more friendly for maintaining your site.
Think for example of a page inheriting from a template that holds the site wide main menu which in it's turn inherits from an empty page which in turn inherits from a bootstrap template. When your Bootstrap version changes there is only one point where you need to make changes and every page in your site now uses your new Bootstrap version.
That said, in current web designs, Ajax and Angular like technologies pretty much obviates the need for many levels of inheritance... though true inheritance still is a very elegant way to build your site.
+1
+1 hope it will be released soon !
+1
Still no progress?
+1
Obviously to having any progress someone have to work on this, if you have any idea or want to implement this feel free to do PR.
Witch files do I have to look on?
Still waiting for this feature !
Some news about nested blocks?
+1 to this feature
Just retire to using Twig if you have no skills to implement this feature yourself for Volt. It was planned for 1.3 milestone, then removed and promised for Phalcon 2 with Zephir, then moved again, now planned for 4.0 milestone... After all, it wasnt done for more than 4 years now, so I believe can be assumed as low-priority.
I have been reverting to Smarty which might be older than Twig but has a better speed benchmark as far as I read. I think they are both a good choice.
However, a template engine comparable to Twig or Smarty with full support for nested blocks or even better: template inheritance would be the only reason to use Phalcons Volt engine. There is a lot to say to implement Smarty or Twig in Zephir.
Though I realize this thread is not the platform, I am strongly in favour of splitting Phalcon into different PHP modules, and a template engine might be a good candidate to build into an autonomous module.
+1 to this feature
Since on production volt templates are translated to plain php anyway so there is no really any performance if little gain we could rewrite template engine to plain php anyway. Sure it will be much slower on developing but easier to implement things because right now except zephir alone which is not really a problem you need to edit c files to implement this feature.
I think you are right @Jurigag, but it sort of obviates the need for Volt alltogether since better template engines are out there... Some runtime template engine features might offer some performance gain when implemented in Zephir/C, but since modern web development focuses on client side templating this will also will not be worth the effort...
Like Symphony, Phalcon should promote third party products such as Twig, Smarty, Doctrine etc.
Maybe there are but not twig - twig is not plain php - it's still using many classes. Making it much slower than blade or volt. I think blade on final form compiles to truly plain php - making it really fast.
How does using classes make PHP not plain? I can be wrong but Volt and Twig are very similar both in terms of used syntax for templates and by outputting template translated into php code.
By using objects, you don't need objects to render html. Each block in twig is an object which just slow down whole thing. This is why blade/volt is faster.
Well, probably some benchmarks needed to show whether there is some significant perfomance difference between Volt and Twig. Also, talking under the issue of unsupported block nesting, faster isn't always better if it's not enough flexible.
+1
This is the only reason I use Twig instead of Volt. Fixing this would be awesome, I would switch back to Volt right away.
One of the most commented feature in this milestone and in the same time in the end of TODO list )
+1
Im giving up using Volt cause that feature, in large and complex templates is very painful maintain using only one level of inheritance. Using phalcon only in API for Vue front.
I would suggest to reads jurijags reply again. Use either Twig or Smarty3 in stead of Volt, it might be slower in compilation time (when the template changes) but it won't matter in execution time (when the template is rendered).
I dismissed many of Phalcons features, but still use the framework basis since it is a fast and clean one.
No twig or smarty3, only blade - twig and smarty3 are not really plain php - for each blocks etc they steal are using many objects and classes for no reason. Blade is pretty much similar in speed as volt on cached views.
Don't know Blade too well but does it support infinite inheritance? From the examples I only see one level, similar to Volt. I agree with Jurigag that Smarty and to a lesser extent Twig is somewhat bloated, but one might like the modular and extensible nature of that. In the end the compiled template defines most of its speed and efficiency. It boils down to a matter of taste. We can agree that Volt still has to improve to compete...
+1
it's very useful feature.
actually "Laravel blade" is more useful than "volt"
see also => "yield, section"
@niden
In version 4.0 of Phalcon it will be possible to use blocks {% block %} under conditions {% if %} and {% else %}?
Closing in favor of #13855. Will revisit if the community votes for it, or in later versions.
Most helpful comment
Obviously to having any progress someone have to work on this, if you have any idea or want to implement this feel free to do PR.