The place for more technical questions for those who want to create new pagetypes or bespoke functionality.

Embedding Yammer, creating Peerfeedback in Xerte

  • JaapJan
  • Onderwerp Auteur
  • Offline
  • Premium lid
  • Premium lid
Meer
9 jaren 2 maanden geleden #4520 door JaapJan
Hi,

I embedded Yammer into Xerte. A nice way to let people discuss with fellow students in the Xerte modules.

I use the following code from, grabbed from a developer Yammer-site:

<div id="embedded-feed" style="height:800px;width:800px;">&nbsp;
</div>
<script type="text/javascript" src=" s0.assets-yammer.com/assets/platform_embed.js ">
</script>
<script type="text/javascript">
yam.connect.embedFeed({
container: "#embedded-feed",
network: "deltion.nl",
feedType: "group",
feedId: "11767134"
});
</script>

The strange thing is now that the feed is not shown at the first visit of the page. When I go to the next page and then back, I can see and use the feed. Refreshing the page with F5 at first visit couses a empty screen.

The test module is here, the Yammer feed is on the second page.
xerte.deltion.nl/play.php?template_id=222

Anyone a idea to change the script so that the feed is seen inmediately?

JaapJan

Holy cow!

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Meer
9 jaren 2 maanden geleden #4521 door JohnSmith
Beantwoord door JohnSmith in topic Embedding Yammer, creating Peerfeedback in Xerte
Hi JaapJan

The problem is that the script platform_embed.js is not loading fast enough - I don't use Yammer so can't test but you need some delay between loading it and executing the next code block, something like this code to replace the last code block above
Code:
<script type="text/javascript"> var yamcheck = function () { if (window.yam) { // ORIGINAL CODE BLOCK GIVEN yam.connect.embedFeed({ container: "#embedded-feed", network: "deltion.nl", feedType: "group", feedId: "11767134" }); } else { setTimeout(yamcheck, 1000); } } yamcheck(); </script>

It just checks if yam exists (since it's used in yam.connect.embedFeed) and if so executes the code block, else it delays for 1 second and repeats... indefinitely so you could add a counter to stop after 20 seconds... something like
Code:
<script type="text/javascript"> var yamcount = 0, yamcheck = function () { if (window.yam) { // ORIGINAL CODE BLOCK GIVEN yam.connect.embedFeed({ container: "#embedded-feed", network: "deltion.nl", feedType: "group", feedId: "11767134" }); } else if (yamcount++ < 20) { setTimeout(yamcheck, 1000); } } yamcheck(); </script>

John
De volgende gebruiker (s) zei dank u: JaapJan

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Moderators: JohnSmith
Tijd voor maken pagina: 0.143 seconden
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo