2

Hi guys i am trying to do and if statement for business catalyst

In bc they give you template tags ie {module_webapps,5502,a,}

I am trying to run a if statement to add this as code to a div.

var pathname = window.location.pathname;

if(pathname == '/test') {

//var mod = "{module" + '_' + "webapps,5502,a,}";

$('.comment-box').html("{module" + '_' + "webapps,5502,a,}");

 //alert(mod);
}

It come through but it shows as text in the webpage and doesnt run the code.

L84
  • 45,514
  • 58
  • 177
  • 257
iSimpleDesign
  • 403
  • 2
  • 7
  • 19
  • You can do this with Liquid now. Since it's an old question I won't bother putting code together. But If you still need it I can help. – Daut Sep 22 '16 at 09:29

2 Answers2

3

You can't do that. The module needs to be in this form {module_webapps,5502,a,} at the server side for the rendering engine to pull the data out. Assembling it like that at the client end will do nothing.

L84
  • 45,514
  • 58
  • 177
  • 257
somecallitblues
  • 680
  • 4
  • 9
0

I know this is a fairly old question, but I've just started delving into BC myself(UGH. What a mess, that admin center of theirs!)

I suspect the reason it's not working for you is that they actually do some preprocessing of the html template files before UA gets the page being requested. Those tags are getting replaced with their relevant content Server-side; Client-side insertion of the template tags won't get preprocessed.

Akoi Meexx
  • 767
  • 2
  • 6
  • 15