Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Fix script code for cs-cart Rate Topic   - - - - -

 
  • Catch1fish
  • Member
  • Members
  • Join Date: 26-May 09
  • 82 posts

Posted 05 August 2009 - 12:40 PM #1

Not sure where this fits in the forums, so will stick in here:

Have some javascript I want to add to our footer.tpl, but I'm missing something small I think - can someone throw me a rope to help me out

original code is like this:

<script type="text/javascript">
var FJHost = ((document.location.protocol == 'https:') ? 
 "https://ssllog." : "http://log.");
document.write(unescape("%3Cscript src='" + FJHost + 
 "feedjit.com/pg/fj/bfd4e61a52187dc8/'" + 
 " type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try { var FJ = FJNew(); FJ.logHit(); } catch(err) {}
</script>

And I'm trying to add it like this:


<script type="text/javascript">
<![CDATA[
var FJHost = ((document.location.protocol == 'https:') ?
"https://ssllog." : "http://log.");
document.write(unescape("%3Cscript src='" + FJHost +
"feedjit.com/pg/fj/bfd4e61a52187dc8/'" +
" type='text/javascript'%3E%3C/script%3E"));
]]>
</script>
<script type="text/javascript">
<![CDATA[
try { var FJ = FJNew(); FJ.logHit(); } catch(err) {}
]]>
</script> 



But no matter how I add the [CDATA] tags I always get an error on the line


try { var FJ = FJNew(); FJ.logHit(); } catch(err) {}


can anyone help?
cs-cart V2.1.4

 
  • snorocket
  • Forum Janitor
  • Members
  • Join Date: 15-Mar 06
  • 2519 posts

Posted 05 August 2009 - 03:11 PM #2

you need to put the javascript code within smarty literal tags, example:

[color=red]{literal}[/color]
<script type="text/javascript">
<![CDATA[
var FJHost = ((document.location.protocol == 'https:') ?
"https://ssllog." : "http://log.");
document.write(unescape("%3Cscript src='" + FJHost +
"feedjit.com/pg/fj/bfd4e61a52187dc8/'" +
" type='text/javascript'%3E%3C/script%3E"));
]]>
</script>
<script type="text/javascript">
<![CDATA[
try { var FJ = FJNew(); FJ.logHit(); } catch(err) {}
]]>
</script>
[color=red]{/literal}[/color]

For your reference:
http://www.smarty.ne...ion.literal.php
SNOROCKET.COM, Now Accepting PRE-ORDERS:
Customer Service (Helpdesk) Addon for CS-Cart v4.3.1
Quote and Invoicing Addon for CS-Cart v4.3.1

 
  • Catch1fish
  • Member
  • Members
  • Join Date: 26-May 09
  • 82 posts

Posted 05 August 2009 - 05:26 PM #3

Excellent! many thanks for your help snorocket - have you actually got room on your chest for another medal? :rolleyes:
cs-cart V2.1.4

 
  • ckad79
  • Senior Member
  • Members
  • Join Date: 20-Jun 07
  • 500 posts

Posted 18 March 2013 - 08:40 PM #4

Is there anyway to stop the cart from editing html through WYSIWYG? I'm trying to add literal tags to a block and it puts the <p> around the literal tag and then the site ignores the javascript I'm adding? I have a google adwords conversion code but the WYSIWYG editor keeps stripping the CDATA part of the code. i've also tried to add a javascript chat button but it ignores the literal tags there too.
"Enjoy yourself, it's later than you think" T. Snider.

 
  • Triplets
  • Senior Member
  • Members
  • Join Date: 23-Sep 08
  • 1179 posts

Posted 18 March 2013 - 08:47 PM #5

In Admin go to Settings : Appearance

Set Default wysiwyg editor: Do Not Use

 
  • ckad79
  • Senior Member
  • Members
  • Join Date: 20-Jun 07
  • 500 posts

Posted 19 March 2013 - 02:03 AM #6

In Admin go to Settings : Appearance

Set Default wysiwyg editor: Do Not Use


Thanks.
"Enjoy yourself, it's later than you think" T. Snider.