MyBB Community Forums

Full Version: Embedding a single post in html, on another page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello there.

We currently have a website under construction, fully based on the mybb structure.
It's still in closed beta, so unfortunately I can't provide a link to help you along. Not that it matters much.

What I'm trying to do is embed a single specific post and / or thread from the forum into the homepage, to act as a sort of easily updatable bulletin board within the page without the use of javascript, iframe or anything of the sort.

I have looked at the code for the portal site, which displays announcements just nicely, but somehow I can't seem to get this to work the way it should on the other page.
And I need this to work with a specific post / thread.

Does anybody have a nice example-esque piece of code or how-to at their disposal?

Help would be greatly appreciated!
Thanks.
:)
You need to call the variables manually on the new page you have created. Make sure you defined ("IN_MYBB"), ("IN_PORTAL", 1) and ('THIS_SCRIPT', 'portal.php')
Thanks, do you mind providing a preferably simple piece of example code (e.g. which you would use to embed this post)?
I'm still a bit confused; nothing seems to be happening. A look at the actual syntax would help me a lot.
Right, so far I've had no success trying PHP. Had a shot at jQuery.

This could get a bit specific from here on, so if you want to move this out of the general support thread, by all means.

Unfortunately, still nothing happens.

Here's my code in the header tag.
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script type="text/javascript">
jQuery("#contain").load("http://examplepage.com/forum/showthread.php?tid=NN #pid_NN");
</script>

And somewhere in the page there's my destination div:
<div id="contain"></div>

Now, I've run a test function to see whether the library has loaded, and apparently it has.
Still, nothing shows. At all. No error reports in the web console either.
What am I doing wrong?