SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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?

  2. #2
    SitePoint Wizard bronze trophy bluedreamer's Avatar
    Join Date
    Jul 2005
    Location
    Middle England
    Posts
    3,397
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Addict
    Join Date
    Oct 2008
    Location
    Virtual World is my location
    Posts
    316
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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.
    FreelanceNext.com - Freelance Projects / Jobs & more...
    BargainNext.com - coupons / deals / bargains / offers & more...

  4. #4
    SitePoint Addict
    Join Date
    Aug 2013
    Location
    New Zealand
    Posts
    302
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    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.

  5. #5
    SitePoint Addict
    Join Date
    Aug 2013
    Location
    New Zealand
    Posts
    302
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  7. #7
    SitePoint Addict
    Join Date
    Aug 2013
    Location
    New Zealand
    Posts
    302
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    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.

  8. #8
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    curl......didn't think of that for some reason.
    I'll give it a try. Thank you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •