andhiirawan

Inline CSS or Javascript in Admin Backend CMS or Static Bloc

Jun 22nd, 2019
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CMS Page Backend :
  2.  
  3. CMS → Pages → Page Information → Design
  4.  
  5. <script type="text/javascript">your code</script>
  6.  
  7. sample
  8.  
  9. <script type="text/javascript" src="//ssp.adskom.com/tags/third-party-async/NjkzNWI2MDYtNzAxNy00NTM3LTljNTQtOTMyZDFmM2RkYjE4" async="true"></script>
  10.  
  11. Backend Static Block :
  12.  
  13. CMS → Static Blocks → Content
  14.  
  15. <script type="text/javascript">// <![CDATA[
  16. you javascript code
  17. // ]]></script>
  18.  
  19. sample
  20.  
  21. <script type="text/javascript">// <![CDATA[
  22. function myFunction() {
  23. var element = document.getElementById("flag-contain");
  24. element.classList.toggle("flagstyle");
  25.  
  26. var element = document.getElementById("arrow-country");
  27. element.classList.toggle("arrowcountry");
  28. }
  29. // ]]></script>
  30.  
  31. Custom Layout Update on Category (via backend) :
  32.  
  33. Catalog → Manage Categories → Category → Custom Design → Custom Layout Update
  34.  
  35. '<reference name="head">
  36. <block type="core/text" name="some_name" as="some_name">
  37. <action method="setText">
  38. <text><![CDATA[<script>your code</script>]]></text>
  39. </action>
  40. </block>
  41. <block type="core/text" name="your.block.name">
  42. <action method="setText">
  43. <text><![CDATA[<script type="text/javascript">your code</script>]]></text>
  44. </action>
  45. </block>
  46. </reference>'
  47.  
  48. sample
  49.  
  50. '<reference name="head">
  51. <block type="core/text" name="some_name" as="some_name">
  52. <action method="setText">
  53. <text><![CDATA[<script async="true" src="//ssp.adskom.com/tags/third-party-async/NzFmZDdkZmMtZDZlMC00MTFlLWJmZTAtNzY2NmZkMjE4ZGM3"></script>]]></text>
  54. </action>
  55. </block>
  56. <block type="core/text" name="your.block.name">
  57. <action method="setText">
  58. <text><![CDATA[<script type="text/javascript">window.location = "https://www.sophieparis.com/special-promo/promo.html";</script>]]></text>
  59. </action>
  60. </block>
  61. </reference>'
  62.  
  63. XML Update Layout in CMS Page (via backend) :
  64.  
  65. CMS → Pages → Page Information → Design → Layout Update XML
  66.  
  67. '<reference name="head">
  68. <block type="core/text" name="custom_css">
  69. <action method="setText">
  70. <text><![CDATA[
  71. <style type="text/css">
  72. cms code in here
  73. </style> ]]>
  74. </text>
  75. </action>
  76. </block>
  77. </reference>'
  78.  
  79. sample :
  80.  
  81. '<reference name="head">
  82. <block type="core/text" name="custom_css">
  83. <action method="setText">
  84. <text><![CDATA[
  85. <style type="text/css">
  86. @media only screen and (max-width : 767px) {
  87. .homepage-our-brand-product {
  88. padding-top: 25px !important;
  89. -webkit-padding-before: 25px !important;
  90. }
  91. }
  92. .homepage-banner-top .banner-right {
  93. padding-top: 0px;
  94. position: relative;
  95. top: -100px;
  96. }
  97. </style> ]]>
  98. </text>
  99. </action>
  100. </block>
  101. </reference>'
RAW Paste Data