Using \yii\web\View
we can register scripts with either:
$view->registerJs();
or
$view->registerJsFile();
but to register a script block with a custom type
and id
that holds a template (like this):
<script id="template" type="x-tmpl-mustache">
<h1>{{heading}}</h1>
<p>{{paragraph}}</p>
</script>
that wouldn’t be possible using the only two methods mentioned above. I tried looking at the documentation and the source code of yii\widgets\View
but nothing useful!