PDA

View Full Version : Including external file


alessai2
01-20-2008, 10:19 AM
I want to know how to include external file.
i have already read the plugin system manual about including external file.
but it says '/path/to/file'
and my file is located at vbulletin's root directory .
name of file is random.php

What i want to know is the variable which contain the forum's url i.e /forum/
so that i can use this code :

ob_start();
include("".$vboptions['forumhome']."/random.php");
$includedphp = ob_get_contents();
ob_end_clean();


but the variable ".$vboptions['forumurl']." isnt working, it gives this error :

Warning: include(/random.php) [function.include]: failed to open stream: No such file or directory in \global.php(360) : eval()'d code on line 4

Warning: include() [function.include]: Failed opening '/random.php' for inclusion (include_path='.;D:\Softwares\Setups\xampp\php\pea r\') in \global.php(360) : eval()'d code on line 4

Please help !!!

Opserty
01-20-2008, 11:37 AM
If its in the same directory as the forum you don't need to use anything:

ob_start();
include_once('random.php');
$includedphp = ob_get_contents();
ob_end_clean();

That should work.

alessai2
01-20-2008, 01:56 PM
what if user goes into my arcade, ie: /forum/arcade.. wont it give error of file not found??

Marco van Herwaarden
01-20-2008, 02:50 PM
You can use:
include(DIR . '/random.php');</SPAN>