can I use a block inside an html tag?

ando
Member | 5
+
0
-

How can I achieve something like this?
I want to give my div a dynamic data attribute

<div {block attribute}{/block}>
{block attribute}data-my-attribute{/block}

But it gives me an error :/

m.brecher
Generous Backer | 889
+
0
-

@ando

Block inside html attribute isnt good way how dynamically add html attributes. The simplest way is use variable:

$this->template->myAttribute = 'data-my-attribute';
<div {$myAttribute}>

In latte is also something like n:attr, but direct rendering variable makes the code cleaner and more modern.