link to file outside sub folder

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
How to do it in php? I work on a mod to phpBB and I have placed the files in a subfolder in the root directory.

root/gadgets/*mod files in here*

root/common.php

The modfiles need to contact common.php in the root directory. How to do it?
Edit:
anyone?
 
Last edited:

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
one method is to use relative linking..
use ../../common.php to get to where you need

or you can hard code it, but placing the exact URL (http...
 

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
I can't use the url because it not only me that gonna use it.

Here is the code:

PHP:
<?php

    define('IN_PHPBB', true);
    $phpbb_root_path = '';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    page_header('LIVE TV');

    $template->set_filenames(array(
        'body' => 'gadget/tv.html',
    ));

    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
    page_footer();
?>
 
Last edited:

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
Hi,
To use your root directory

you have to use ../ etc

event if you are going to use the include function.

u can use it like this

$phpbb_root_path="../";
include($phpbb_root_path . 'common.' . $phpEx);

This will work fine i think

Good luck
 

bonzo meier

Member
Messages
47
Reaction score
0
Points
6
hi,

i think sunils is right, anyway if you keep getting errors try

$phpbb_root_path= $_SERVER['DOCUMENT_ROOT']."/";
include($phpbb_root_path . 'common.' . $phpEx);

if it still doesn´t work, maybe you get along better with include_once() instead of include(), as there might be a special include path set in your php configuration
 
Top