Thread Rating:
  • 17 Vote(s) - 4.35 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MyBB Integrator / MyBB SDK (Version 1.3)
#21
It's a class that has functions that allow you to use MyBB functions on a custom site.
Reply
#22
This works....
require_once './global.php';

The above works only if the file "testpage.php" is in the same directory as the forum.

When using in another directory...
require_once './mybb/global.php';
... then the file "global.php" does get included (since I changed the file path), but...
  • Warning: require_once(./inc/init.php) [function.require-once]: failed to open stream: No such file or directory in....

global.php has at least one "require_once" file and the file paths are always messed up when including "global.php" in any file outside of MyBB's root. Huh

Please, anyone, tell me how to solve this, before I waste a lot more time.
Thank you.

EDIT:
What if I change all the "require_once" file paths in "global.php" to the full path "/home/usename/public_html...etc..." ?
EDIT#2:
int.php has a large number of required files, so what if I change them all to the full file path. Will this work?

What is the better option?
#
MyBB is the best forum software! Exclamation

Reply
#23
Please give us a short info on how your folder structure looks.
If you are in the root folder like /public_html/ and your mybb is located in /public_html/mybb/, while your "outside-mybb-file" is in /public_html/ you need to use the folder path:
require_once 'mybb/global.php';

In case that does not work I would like to know if you get the same errors using chmod.
On my webspace, it didn't matter if I used chmod or included global.php directly. But maybe that is not common..
Reply
#24
(2009-03-27, 06:20 AM)No0oB Wrote: Please give us a short info on how your folder structure looks.
If you are in the root folder like /public_html/ and your mybb is located in /public_html/mybb/, while your "outside-mybb-file" is in /public_html/ you need to use the folder path:
[php]require_once 'mybb/global.php';

Yes, that is the way I was trying to use it.
Since the error message mentions, "Warning: require_once(./inc/init.php)...", I'm assuming the code inside 'global.php' was included, and now the system is trying to find "./inc/init.php" in the wrong place.


(2009-03-27, 06:20 AM)No0oB Wrote: In case that does not work I would like to know if you get the same errors using chmod.
On my webspace, it didn't matter if I used chmod or included global.php directly. But maybe that is not common..

I'm not sure exactly what you mean by using chmod for this.
FYI, the problem does happen on more than one host.
#
MyBB is the best forum software! Exclamation

Reply
#25
What exactly is your folder structure on your webhost?
Reply
#26
(2009-03-27, 01:40 PM)No0oB Wrote: What exactly is your folder structure on your webhost?

forum = /public_html/mybb/
testpage.php (site to integrate) = /public_html/
#
MyBB is the best forum software! Exclamation

Reply
#27
Then your include code needs to be:
define('IN_MYBB', NULL);
require_once 'mybb/global.php';
require_once('class.MyBBIntegrator.php';

If that does not work, try to declare a constant holding your Root Site.
I did that with codeworld.
It looks like the following:
define('ROOT_DIR', getcwd());
require_once ROOT_DIR . '/mybb/global.php';
require_once ROOT_DIR . '/class.MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang);
Reply
#28
^^^
I might try the constant later.
For now, I got it working this way...
<?php
define('IN_MYBB', NULL);
chdir('mybb'); // path to MyBB
require_once './global.php';
require_once 'class.MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang); 
?>

The above works on at least one host.
Thank you, very much for the Integrator class. Smile
#
MyBB is the best forum software! Exclamation

Reply
#29
You would have to chdir back thou....
So your Integration Class is located in the mybb folder?
Maybe that was the reason it didn't work Smile

Little Update: Added a fancy download counter!
Will also add a comment system to enable direct feedback.

Also, in a week or so, I will start enhancing the Integrator. Let's see what's needed.
Reply
#30
The ideal solution is to fix global.php et al to make use of the dir_name function in PHP, so we don't have to chdir before including them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)