Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Adding JS into header/body.tpl causes internal error

 
Closed Thread
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 07-23-2016, 08:32 PM
 
kontrabass_forum kontrabass_forum is offline
 

Advanced Member
  
Join Date: Mar 2016
Posts: 41
 

Default Adding JS into header/body.tpl causes internal error

Hello,

I'm trying to add some JS into my <head></head>, to display a site ssl seal.. Using theme tweaker, I edit the template theme_tweaker/default/en/header/body.tpl and put in the javascript:
Code:
<script type="text/javascript"> var __dcid = __dcid || [];__dcid.push(["DigiCertClickID_wrFGN2rC", "5", "l", "black", "wrFGN2rC"]);(function(){var cid=document.createElement("script");cid.async=true;cid.src="//seal.digicert.com/seals/cascade/seal.min.js";var s = document.getElementsByTagName("script");var ls = s[(s.length - 1)];ls.parentNode.insertBefore(cid, ls.nextSibling);}()); </script>

However, it only causes an "internal error".... Is there something in this javascript code that's throwing off the template?
__________________
x-cart 5.3.x
  #2  
Old 07-24-2016, 10:59 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Adding JS into header/body.tpl causes internal error

Try this:
Code:
<script type="text/javascript"> var __dcid = __dcid || [];__dcid.push(["DigiCertClickID_wrFGN2rC", "5", "l", "black", "wrFGN2rC"]); (function() { var cid=document.createElement("script");cid.async=true;cid.src="//seal.digicert.com/seals/cascade/seal.min.js"; var s = document.getElementsByTagName("script");var ls = s[(s.length - 1)]; ls.parentNode.insertBefore(cid, ls.nextSibling); } ()); </script>
Spacing and line breaks will help the Flexy template engine recognize what it is and not parse it.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.

The following 2 users thank totaltec for this useful post:
kontrabass_forum (07-24-2016), qualiteam (07-27-2016)
  #3  
Old 07-24-2016, 12:16 PM
 
kontrabass_forum kontrabass_forum is offline
 

Advanced Member
  
Join Date: Mar 2016
Posts: 41
 

Default Re: Adding JS into header/body.tpl causes internal error

Quote:
Originally Posted by totaltec
Try this:
Code:
<script type="text/javascript"> var __dcid = __dcid || [];__dcid.push(["DigiCertClickID_wrFGN2rC", "5", "l", "black", "wrFGN2rC"]); (function() { var cid=document.createElement("script");cid.async=true;cid.src="//seal.digicert.com/seals/cascade/seal.min.js"; var s = document.getElementsByTagName("script");var ls = s[(s.length - 1)]; ls.parentNode.insertBefore(cid, ls.nextSibling); } ()); </script>
Spacing and line breaks will help the Flexy template engine recognize what it is and not parse it.

That helped Thanks again!
__________________
x-cart 5.3.x
Closed Thread
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:59 AM.

   

 
X-Cart forums © 2001-2020