Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Comment inside literal

Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Smarty Rookie

Joined: 06 Sep 2018
Posts: 11

PostPosted: Mon Oct 15, 2018 3:17 pm    Post subject: Comment inside literal Reply with quote

Hi to all

I have a question, I have the follow code, my boss told me that its necessary to hide the comments but I have problem with that....


<!--<script async type="text/javascript" src="/assets/plugins/bootstrap/js/bootstrap.min.js"></script>-->
<script src="//" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script type="text/javascript" src="/assets/plugins/sidr/jquery.sidr.min.js"></script>
<script src="/assets/js/scripts-footer-min.js"></script>
<!--<script type="text/javascript" src="/assets/plugins/hover-dropdown.min.js"></script>
<script type="text/javascript" src="/assets/plugins/fancybox/source/jquery.fancybox.pack.js"></script>
<script type="text/javascript" src="/assets/plugins/psScrollbar/psScrollw_mw.min.js"></script>
<script type="text/javascript" src="/assets/plugins/sidr/jquery.sidr.min.js"></script>
<script type="text/javascript" src="/assets/js/app.js"></script>
<script type="text/javascript" src="/assets/js/isIndexImported.js"></script>
<!-- Google Analytics -->
<!--<script type="text/javascript" src="/assets/js/google-analytics.js"></script> -->
<script async src='//'></script>
<!-- End Google Analytics -->

<!--<script type="text/javascript" src="/assets/js/facebook-pixel-code.js"></script> -->
<noscript><img height="1" width="1" style="display:none" src=""/></noscript>
<!-- DO NOT MODIFY -->
<!-- End Facebook Pixel Code -->

But when I saw the source code of the page I saw the comments <!-- -->, I have tried to use {* *} but don[t work

Is there a way to hide the comments in literal for source code ?

Thank you for your help
Back to top
View user's profile Send private message

Joined: 03 Dec 2012
Posts: 1622

PostPosted: Mon Oct 15, 2018 7:42 pm    Post subject: Reply with quote

{literal} prevents any smarty parsing. So, "{* *}" won't work.
The HTML comments, however… why not just remove them?
And move googlecrap to a separate include. (That's a strong suggestion.)
Back to top
View user's profile Send private message
Smarty Elite

Joined: 20 Dec 2011
Posts: 266
Location: West Coast

PostPosted: Tue Oct 16, 2018 1:22 am    Post subject: Reply with quote

Unless there is more than what you posted, I do not see any actual javascript or actual CSS. Actual javascript and CSS could have tight braces which is the cause for the use of {literal} is necessary.

You could experiment by removing {literal}, then wrapping the to be hidden <script src> tags in Smarty comment tags.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP