I do have that code:
ob_start();
include($this->testTpl);
$html = ob_get_clean();
$pattern = '/{{{\s*(.+?)\s*}}}(\r?\n)?/s';
echo preg_replace_callback($pattern, function($matches) {
return "<?php htmlspecialchars({$matches[1]}); ?>";
}, $html);
and the testTpl file is a php file having this inside:
<div class="something">
<ul>
<li>{{{ $data->something }}}</li>
</ul>
the text is replaced but when I echo it what's returned is:
<li><!--?php htmlspecialchars($data--->something); ?></li>
I don't have the smallest clue why that's happening... anyone any thoughts? any help is appreciated
It's already PHP no need for another set of tags
<?php ?>