Embedding not working in Expression Engine page

embedding

(Barry Parr) #1

I’m trying to get embedding set up on my site. Topics are being created in my Discourse forum, but the topic and replies are not showing up on my site.

The site uses Expression Engine. It’s a PHP-based CMS. But all pages are cached & delivered as flat html.

Here’s the embed code on this page

<div id="discourse-comments"></div>

<script type="text/javascript">
  var discourseUrl = "http://forum.coastsider.com/",
      discourseEmbedUrl = 'http://coastsider.com/site/news/testing_led_lights_on_the_midcoast';

  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
      d.src = discourseUrl   'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();
</script>

(Jeff Atwood) #2

Likely due to the extra slash in the URL? Double check your settings, please.

What do you think @eviltrout?


(Barry Parr) #3

I deleted the slash in the URL, but that didn’t help.


(Barry Parr) #4

I solved the problem. Expression Engine uses curly braces to indicate variables, so it was changing the Javascript.

The solutions is to put the braces on separate lines, per the EE site on Stack Overflow:


(Jeff Atwood) #5