1 (edited by rr1024 2007-01-23 05:09)

Topic: Including PunBB in another script

Hello, I'm trying to include punbb in another script....I already have a members area and a template system. I've done this successfully with several other scripts but I'm having a hard time. I'm sure it has something to do with the security, but not sure?


I created a simple php file for testing called my-index.php the contents

<?php

Echo PageCompPageMainCode();

FUNCTION PageCompPageMainCode()
{
    GLOBAL $content_w;
    GLOBAL $dir;
    GLOBAL $site;


      $out  = '';
        $out .= '
                   <TABLE width="'.($content_w-20).'" cellpadding="4" cellspacing="4">
                      <TR>
                         <TD align="center" class="text2">';
                 ob_start();  #  Turn on output buffering
                  require_once("config.php");
                        define('PUN', 1);
                        define('PUN_ROOT', './');

                      //require_once("include/dblayer/common_db.php");  #  External Script includes
                      //  require PUN_ROOT.'include/common.php';
                        require_once("index.php");  #  External Script includes

                        $out .= ob_get_contents(); # Return the contents of the output buffer
                      ob_end_clean();  #  Clean (erase) the output buffer and turn off output buffering


        $out .= '
                         </TD>
                      </TR>
                   </TABLE>';

        RETURN $out;
}
?>

The error I keep getting is this

Fatal error: Call to a member function on a non-object in /home/dating/forum/include/functions.php on line 110

I don't know alot about classes but the basic idea is I have a blank page that I want the forum to run in and it will need to be processed in
the function PageCompPageMainCode()

FYI this require is the punbb index.php in the above function
require_once("index.php");  #  External Script includes
If I can get it to echo out from PageCompPageMainCode() then PunBB will just run inside my template.  Is it possible to do this?

Thanks for any help

2 (edited by rr1024 2007-01-23 05:52)

Re: Including PunBB in another script

Ok I found where someone had a similar issue with integration and adding the
Global $db; resolved

Fatal error: Call to a member function on a non-object in /home/dating/forum/include/functions.php on line 110

However, I have a new issue I get
There is no valid language pack '' installed. Please reinstall a language of that name.


Now just so you know that my-index.php is in the same directory /forum/ and when I browse to index.php pun runs great, so maybe i need to include the lang pack?

I did install Punbb in one directory and then I just reuploaded it, should I just do a re-install or is there someting else?

Re: Including PunBB in another script

try adding $lang_common to the global bit

4 (edited by rr1024 2007-01-23 14:50)

Re: Including PunBB in another script

Thanks Smarty I tried adding GLOBAL $lang_common; to the global list and I got the same error


Maybe I should echo out both $lang_common , PUN_ROOT , $pun_config['o_default_lang']: however I'm not sure where $lang_common is being set to begin with...

I already know that $lang_common is unset or '' it mybe nice to know if the root was correct but it it wasn't then I'd get file not found in path error!

hmmmm, still thinking....LOL

Re: Including PunBB in another script

$pun_config and $pun_user need to be global too.

Re: Including PunBB in another script

eat shcks!!!!!!