Adding Javascript code to Page Content

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
graphixtyle
New Member
New Member
Posts: 1
Joined: Tue Feb 20, 2018 4:20 am

Adding Javascript code to Page Content

Post by graphixtyle »

Hi everyone. Looking for a quick reply as helping out a new client using CMSMS and I have never used before.

They are wanting to add their Shopify products to a page within their CMSMS developed site.

I have created a new page, disabled the WYSIWYG editor and pasted the code generated by Shopify for their "Buy Button" that allows placement of products on any site or blog. All I get is a page of errors like below.

Can anyone steer me in the right direction to get this working please?

-----
string(120) "Smarty error: [in content:content_en line 5]: syntax error: unrecognized tag 'var' (Smarty_Compiler.class.php, line 590)" string(129) "Smarty error: [in content:content_en line 8]: syntax error: unrecognized tag: loadScript(); (Smarty_Compiler.class.php, line 446)" string(117) "Smarty error: [in content:content_en line 8]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(129) "Smarty error: [in content:content_en line 9]: syntax error: unrecognized tag: loadScript(); (Smarty_Compiler.class.php, line 446)" string(117) "Smarty error: [in content:content_en line 9]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(121) "Smarty error: [in content:content_en line 11]: syntax error: unrecognized tag 'var' (Smarty_Compiler.class.php, line 590)" string(121) "Smarty error: [in content:content_en line 17]: syntax error: unrecognized tag 'var' (Smarty_Compiler.class.php, line 590)" string(530) "Smarty error: [in content:content_en line 22]: syntax error: unrecognized tag: ui.createComponent('product', { id: [509534208058], node: document.getElementById('product-component-115228cb691'), moneyFormat: '%24%7B%7Bamount%7D%7D', options: { "product": { "variantId": "all", "contents": { "imgWithCarousel": false, "variantTitle": false, "description": false, "buttonWithQuantity": false, "quantity": false (Smarty_Compiler.class.php, line 446)" string(118) "Smarty error: [in content:content_en line 22]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(267) "Smarty error: [in content:content_en line 35]: syntax error: unrecognized tag: "product": { "@media (min-width: 601px)": { "max-width": "100%", "margin-left": "0", "margin-bottom": "50px" (Smarty_Compiler.class.php, line 446)" string(118) "Smarty error: [in content:content_en line 35]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(136) "Smarty error: [in content:content_en line 41]: syntax error: unrecognized tag: "font-size": "12px" (Smarty_Compiler.class.php, line 446)" string(118) "Smarty error: [in content:content_en line 41]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(152) "Smarty error: [in content:content_en line 44]: syntax error: unrecognized tag: "contents": { "button": true (Smarty_Compiler.class.php, line 446)" string(118) "Smarty error: [in content:content_en line 44]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(167) "Smarty error: [in content:content_en line 46]: syntax error: unrecognized tag: "footer": { "background-color": "#ffffff" (Smarty_Compiler.class.php, line 446)" string(118) "Smarty error: [in content:content_en line 46]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(297) "Smarty error: [in content:content_en line 50]: syntax error: unrecognized tag: "contents": { "img": false, "imgWithCarousel": true, "variantTitle": false, "buttonWithQuantity": true, "button": false, "quantity": false (Smarty_Compiler.class.php, line 446)" string(118) "Smarty error: [in content:content_en line 50]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(268) "Smarty error: [in content:content_en line 57]: syntax error: unrecognized tag: "product": { "@media (min-width: 601px)": { "max-width": "100%", "margin-left": "0px", "margin-bottom": "0px" (Smarty_Compiler.class.php, line 446)" string(118) "Smarty error: [in content:content_en line 57]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(223) "Smarty error: [in content:content_en line 65]: syntax error: unrecognized tag: "styles": { "products": { "@media (min-width: 601px)": { "margin-left": "-20px" (Smarty_Compiler.class.php, line 446)" string(118) "Smarty error: [in content:content_en line 65]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)"
------
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Adding Javascript code to Page Content

Post by velden »

Make sure that all curly brackets { } have a space before and after them. Else the Smarty engine used in CMS Made Simple will try to interpret it as tag which doesn't exist.

so for example:

Code: Select all

function() {var foo=bar;}
should be

Code: Select all

function() { var foo=bar; } 
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Adding Javascript code to Page Content

Post by Rolf »

Or wrap the code within {literal} {/literal}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “CMSMS Core”