A new feature for SilverStripe should be ...

Template blocks/sections with inheritance

We should implement block/section functionality seen in other templating languages so that we can reduce the instances of repeated code when there are variations of a template that cannot be shared due to the inherent limitations of includes.

- Twig: https://twig.symfony.com/doc/2.x/tags/extends.html
- Blade: https://laravel.com/docs/5.0/templates

While the advantages of blocks are likely already known, I’ll explain my use case. There are many instances in my case where I could have HTML code that must be repeated around includes which could otherwise be inverted such that the typically included code is embedded into the template and the variable components would instead be plugged into the blocks of the parent template (which itself is also capable of utilizing includes).

Relates to https://silverstripe.uservoice.com/forums/251266-new-features/suggestions/6478017-themes-should-be-more-powerful

And commented here for this specific capability: https://github.com/silverstripe/silverstripe-framework/issues/5604#issuecomment-337750308

24 votes
Vote
Sign in
(thinking…)
Sign in with: Facebook Google
Signed in as (Sign out)
You have left! (?) (thinking…)
Patrick Nelson shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Sign in with: Facebook Google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base