Embedding a forum as an iframe

IFRAMEs have a bad reputation. I understand the sometimes confusing search engine arguments against (search links will often point to the iframe alone, rather than to the enclosing page as a whole).

However, I run a discussion forum on my boat building website that now has 20,000 posts. It’s a valuable addition to the boat building community and to my website. But I want that forum to appear as the contents of a block element <div> inside my content management system (Robopages). Stripping the <html> <head> and <body> elements from the forum’s *.tpl templates won’t work without major php code modifications, because the forum’s links are generated the wrong way (not to work as a plugin to an enclosing system) and because of conditional header branching:

if ($php_condition)
header("location: $this);
else
header("location: $that); …this sort of thing results in chaos for an enclosing CMS

I just finished several days of work hacking a simpler open source forum so it could be used in embedded mode. But that simpler forum lacks features I want.
What ARE the arguments against simply putting my original forum inside an iframe, so it can appear as an integral part of my enclosing CMS. Even though it isn’t?

If it’s just the search engine argument perhaps I don’t care. Why doesn’t SOMEBODY make an open source forum that can indeed be embedded?

What happens if someone links directly to a forum thread from an external site?

I’d recommend customising the forum itsself with your logo and general colours and simply link to it from your main site, and providing a link back from the forum.

Which forum software are you using? sometimes it may be possible to embed the forum, but my suggestion would be to either convert your entire site + forum to some other CMS rather than using Iframe because a user wont be able to link to individual posts.

Depending on the forum software it can be relatively easy to a major pain. Here are some ideas each of differing merit.

  • Trying to reengineer a web template is awkward. Not sure what happens if you later upgrade the forum software, say, to deal with an exploit or security issue. You’re in danger of losing your changes. This is quite a difficult option to get to work in practice.

  • I understamd Nabble is an embeddable forum. Its not really open source but a hosted solution. Its prbably the easiest option. (http://www.nabble.com)

  • You may be able to modify the template on the fly before it gets embedded into the iframe. This will require some link rewriting. Its effectively adding a proxy between your iframe and the forum. This is what I consider to be medium difficulty. The advantage here is that security updates dont break your modifications.

Anyway, without thinking it through too deeply those are my thoughts.

Here’s another one I found:

Talki looks interesting. But it is Wordpress specific. Yes, re-engineering *.tpl templates is difficult (worse than coding…well it is coding) and precarious, because new software updates (as you pointed out) so often break your *.tpl modifications. I used templates when I was a java programmer. Then they make sense because you can edit templates directly from the keyboard without recompiling the enclosing Java codes.

For interpreted languages I don’t really like templates. You gain a little and lose a lot. The templates are tightly coupled to calling statements hidden who knows where in the enclosing language (usually PHP). Templates are supposed to separate content from programming logic. But they don’t do that. They just move the content into a mess of hard-to-deal-with IF AND OR ELSE templating logic, where simple changes are easy but complex changes are now more difficult. This is off topic I guess. But I hate templating and never use it myself. I’d rather write good code.

Ok, sorry, when you mentioned php on one hand and cms on the other I assumed wordpress. What you could do then is the proxy idea of using something like php and curl to fetch the iframe contents in the background and then parse the html and remove the header and rewrite the links to your preferred url namespace and then display it in the iframe. When someone clicks on a forum link you will need to either capture the request data from a custom php module or rewrite it back to how the forum software understands or .maybe use apache url rewriting if you’re using apache.

Because all of this rewriting is taking place in memory and not in the template it shouldn’t be particularly brittle.

curl…didn’t think of that for some reason.
I’ll give it a try. Thank you.