Re-define part of block, kindof micro-layout

3 years ago

amik
Member | 124
+
0
-

Hi,
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>
</div>
{/}
...
{block #userPanel}
    {extends #panel, heading => 'User info'} {* or something like this *}
    {block #panelContent}Some user info there...{/}
{/block}

The only way I figured out is this:

{capture $content}
Some user info there...
{/capture}
{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 :)