Forum Moderators: coopster
I'd like to 'frame' or wrap a forum (simplemachines) into a table cell, and confine it to that cell, (with ofcourse no limitation on the vertical length,) only not with those hated frames. If its called 'index.php' how could I go about doing that?
I'm able to do a php-include, but, but not a php-include of subsequent clicks. Is there a method use some sort of an infinite while loop or recursion of the php include statement to accomplish this? Would this affect load times or anything. (I know very little about php right now)
-thanks in advance
the thing you'd like to do ist not that simple but it's possible. befor starting to code, you need to create a concept, on how to do it. this is bound to how the forum works, which means, you need even to understand the code of the forum quite well.
the first gap ist not to use any of the request variables in your own script in front of the forum execution otherwise the forum will get wrong data to render its pages.
then you need to think about a mechanism not only to include the forum pages (because this leads to wrong links as you wrote), you need to "include" the content as well, so you can change the links wihtin the forums content.
since the forum is php based, include at firsthand would be the weapon of choice. since the forum outputs itself to the browser, you need to create a kind of "internal output", to catch the forums output and replace the links with yours then. the weapon of choice for that is output buffering (or control) [de.php.net] and it comes with php.
so how can this theoretically work? let's take an example. "your" script (#1) is called
forum.php the forum itself (#2) is called forum/index.php. for #1 this means:
<?
// start output buffering
ob_start(); // include the forum
include("forum/index.php");
// get the contents of output buffer
$t = ob_get_contents();
// stop output buffering and clear buffer
ob_end_clean();
//replace the links
$t = str_replace('index.php','forum.php',$t);
// output the "new" page to the browser
echo($t);
?>
if you just copy and paste the code, keep in mind, that
index.php and forum.php are values i've been chosen. these have to be changed to what you really need. #2 is replaced with #1 here and that's it. if the output of your forum uses absolute uris, you need to make additional changes. this should do the trick. keep in mind you need more ram for these kind of scripts, because of the overhead.
--hakre