Re-define part of block, kindof micro-layout

4 years ago

Member | 124

is it possible to re-define part of block – something like defining a micro-layout for a single block?

I want something like this:

{** @param string $heading *}
{define #panel}
<div class="panel panel-default">
    <div class="panel-heading">{$heading}</div>
    <div class="panel-body">{block #panelContent}{/}</div>
{block #userPanel}
    {extends #panel, heading => 'User info'} {* or something like this *}
    {block #panelContent}Some user info there...{/}

The only way I figured out is this:

{capture $content}
Some user info there...
{include #panel, heading=>'User info', content=>$content}

This is working, but I don't like it because

  • the writing form is not nice and clear
  • capture uses output buffering, which is not necessary for this issue.

Thanks for answers :)