Comments (71)
Actually this is why i'm using twig instead of volt
from phalcon.
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.
from phalcon.
This is the only reason I use Twig instead of Volt. Fixing this would be awesome, I would switch back to Volt right away.
from phalcon.
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.
from phalcon.
+1 hope it will be released soon !
from phalcon.
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.
from phalcon.
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.
from phalcon.
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.
from phalcon.
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.
from phalcon.
from phalcon.
This has all been outlined in our blog (https://blog.phalcon.io).
- v5 is the extension. It will remain as such.
- v6 will be rewritten in PHP. Additionally benchmarks will be created for this version to identify slow areas of the code. Those areas will be also written in Zephir and will be offered as an extension. So you can install Phalcon with composer but if you want additional boost, you can also install the extension for v6.
from phalcon.
Stale bots are the plague of GitHub making any inactivity a sign of "everything is great now" and closing unresolved issues...
from phalcon.
Stale bots are the plague of GitHub making any inactivity a sign of "everything is great now" and closing unresolved issues...
Yeah, after today I am considering deactivating it. I had to remove the stale label from over 20 issues so far :/
from phalcon.
The same question. Is there a plans to implement this feature?
from phalcon.
Greetings!
Is there any plans to implement this feature?
from phalcon.
Hi, is there any plans? I think this feature is important.
from phalcon.
+1
from phalcon.
I upvote for the feature
from phalcon.
Agreed. It would be nice to have a block inside an if statement.
from phalcon.
I think it's very useful feature. Waiting for this!
from phalcon.
+1 for this great feature
from phalcon.
Any improvements after almost a year? As for me, this is the most needed missing feature in Volt
from phalcon.
This will be implemented in Phalcon 2 with Zephir
from phalcon.
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?
from phalcon.
+1 to implement this feature in 1.3.x
from phalcon.
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.
from phalcon.
@phalcon told
This will be implemented in Phalcon 2 with Zephir
from phalcon.
Just curious, when will Phalcon 2 be released?
from phalcon.
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)
from phalcon.
And i use twig because I assume that the template are cached once they are parsed ;)
from phalcon.
+1 We need it so bad!
from phalcon.
I have moved to Twig completely for rendering templates. It's more mature and has better docs.
from phalcon.
Hi guys, do we have some updates for this feature?
from phalcon.
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.
from phalcon.
@reedgz I'll be addressing this soon
from phalcon.
@andresgutierrez Thanks man. I am still developing with volt; just used some include
to work around the problem. Fortunately my views are relatively simple.
from phalcon.
Nothing at all?
from phalcon.
I switched to Twig as well...
from phalcon.
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?
from phalcon.
@redstrike "A LOT OF TROUBLES" "TOO GREAT"
from phalcon.
I need this feature as soon as possible! please, it's a shame that this magnificent framework doesn't have something so important. Thanks
from phalcon.
up
from phalcon.
Can't we work with Twig until its implemented? Need this indeed.
from phalcon.
yes, Twig our saver but it's not a good solution at all ((
from phalcon.
Could the need for nested blocks be solved by using nested partials?
from phalcon.
+1
from phalcon.
+1
from phalcon.
Still no progress?
+1
from phalcon.
Witch files do I have to look on?
from phalcon.
https://github.com/phalcon/cphalcon/tree/master/phalcon/mvc/view/engine
from phalcon.
Still waiting for this feature !
from phalcon.
Some news about nested blocks?
from phalcon.
+1 to this feature
from phalcon.
+1 to this feature
from phalcon.
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.
from phalcon.
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.
from phalcon.
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.
from phalcon.
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.
from phalcon.
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.
from phalcon.
+1
from phalcon.
One of the most commented feature in this milestone and in the same time in the end of TODO list )
from phalcon.
+1
from phalcon.
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.
from phalcon.
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.
from phalcon.
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...
from phalcon.
+1
it's very useful feature.
actually "Laravel blade" is more useful than "volt"
see also => "yield, section"
from phalcon.
In version 4.0 of Phalcon it will be possible to use blocks {% block %}
under conditions {% if %}
and {% else %}
?
from phalcon.
Closing in favor of phalcon/cphalcon#13855. Will revisit if the community votes for it, or in later versions.
from phalcon.
Is there a deadline for this feature or will it be postponed forever?
from phalcon.
This will be addressed when we start working on v6 which will be the PHP version of Phalcon. There is no deadline as of yet and it has not been abandoned. Once v5 is out and stable we will start working on v6
from phalcon.
@gianks Please read this blog post - https://blog.phalcon.io/post/phalcon-roadmap
from phalcon.
Related Issues (20)
- [NFR]: Replace regexp in the router with arrays for extra performance
- Can't access page, 404 FORBIDDEN HOT 1
- Can I use `$this->getRelated` on already cached data?
- [BUG]: Scrutinizer Fixes HOT 1
- [NFR]: ADD sticky for read write connection
- [NFR]: removeBehavior method in Model
- [NFR]:returnedValue not updated after dispatcher->forward
- [NFR]: No way to add html attributes to Select Tag. documentation inadequate HOT 1
- [BUG]: The "setDefault" method does not work for forms of type "text" with name "value" HOT 5
- update src folder links
- How to use cookie in phalcon 4.x ? HOT 1
- update tests folder links
- [NFR]: Complete rework of ORM HOT 3
- [BUG]: \Phalcon\Encryption\Crypt + named parameters/arguments throw fatal error. HOT 1
- [NFR]: Refactor Phalcon\Mvc\Router/Route HOT 1
- [NFR]: Refactor Phalcon\Mvc\Model\MetaData
- phalcon 3,4 webhook problem HOT 2
- [NFR]: What is the purpose of this library? HOT 3
- [NFR]: Add a getResult() or fetchAll() method to Resultset\Simple
- [BUG]: when i use JWT Builder , api returns blank HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phalcon.