Currently we have "layers", "partials" and "extend". In fact we also have ->pick() method, render(), getRender() too. When we use View/Simple - the event "dispatcher:afterRoute" cannot be used because render() called before "afterRoute" fired.
The partials is great idea but a best one is adding to volt "set"/"endset" methods to add some html into variable. Better than creating new files for 5 html lines must be in [a] tag
When we append callback to "view:beforeRender" - it will fire in every view (layout, template and every call the view) - it means every controller will make actions several times, on every render executed.
How about rewrite PICK() method to behavior just wrapping view picked before? (or lets call it PUSH, can be reversed or no)
- view->push('/index/page/page1337'); // 1337...
- ...1333 iterations
- view->push('/index/page'); // 3
- view->push('/index/layout'); // 2
- view->push('/html/layout'); // 1
expected to produce
- html/layout
- index/layout (as getContent())
- index/page (as getContent())
- ...1333 other views (as getContent())
- '/index/page/page1337' (as getContent())
Phalcon is best for creating APIs but working with templates is very difficult to create all needs. We or using SimpleView without eventsManager, or using Hierarchy (holding yourself from changing view names and unlimited nesting) or just writing own View that means - we dont use Phalcon flow at all giving all the stuff for webpack and something like Angular