Is possible render the same value more than one time?

Notice: This thread is very old.
zorjks
Member | 2
+
0
-

I made a @layout.latte with something like that:

<?php
<br>writing page content on header<br>
{block userName}{/block}
<br>writing page content on footer<br>
{block userName}{/block}
?>

on my template.latte i have something like that:

<?php
{block userName}<br>theusernamehere{/block}
?>

and i was expecting something like that:

<?php
<br>writing page content on header<br>
<br>theusernamehere
<br>writing page content on footer<br>
<br>theusernamehere
?>

but it gave me:

Uncaught exception ‘Latte\CompileException’ with message ‘Cannot redeclare static block 'userName’ ......

im using literal on my template.latte but i will put somehing like mymodel->getUserName there.

Is possible render the same value more than one time? when i rename one of blocks inside @layout.latte to userNameX it compile but make the renamed empty as expected but not desired.
Is possible more than a level of template inheritance ?
There is this question butdont answer mine: https://forum.nette.org/…-block-title

Thanks a lot.

norbe
Backer | 405
+
+3
-

You have to replace second {block username}{/block} with {include username}

zorjks
Member | 2
+
0
-

Thanks a lot. It works! I will search the logic to understand now.