I have an app where admin can store analytics code to database. I save this code with:
$analytics = htmlentities($value);
So I end up with something like this in my DB:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('send', 'pageview');
</script>
Then I try to output this in my blade template:
{!! $site_settings->get("analyticsCode")->value !!}
Unfortunately blade cannot unescape the script section:
<script>
I have tried also with HTML::decode without success.
<and>are saved as<and>in the database row? Did you try a simplestr_replaceto output them as<and>?HTML::decode()? It's a wrapper forhtml_entity_decode(){!! Html::decode( $site_settings->get("analyticsCode")->value ) !!}The double exclamation mark do the job.