Good all the time of day, there was some problem ...
The following line is stored in the database:
<div class="lol">{foreach(message)}<div class="123">{message.user}</div><div>{message.text}</div>{endforeach}</div> When we make a request to display this content, before giving an answer, we parse it.
The question of how to make it so that from this: {foreach(message)} is this: <?=foreach($parent as $message);?>
Simply put, to get such source code
<div class="lol"><? foreach($parent as $message) ?><div class="123"><?=$message['user'];?></div><div><?=$message['text'];?></div><?=endforeach;?></div>
bladepattern. - Naumov