Broleta Posted June 28, 2008 Share Posted June 28, 2008 Hello, I have encountered a problem with my website. I am trying to use two separate mods/addons for vbulletin to display news from a forum and a login panel respectively. The problem is that both scripts require me to add a code at the "very top" of my website php file. I have tried adding one after the other with no success. I have tried using includes to include the scripts and adding the top codes to them instead but this does not work. The top codes are: For the news script: <?php chdir('./forums'); require_once('./vBExternal.php'); ?> For the login panel script: <?php $curdir = getcwd (); chdir('forums'); require_once('forums/global.php'); chdir ($curdir); ?> Quote Link to comment https://forums.phpfreaks.com/topic/112331-two-codes-at-the-very-top-conflicting/ Share on other sites More sharing options...
br0ken Posted June 28, 2008 Share Posted June 28, 2008 Try this... <?php $curdir = getcwd (); chdir('./forums'); require_once('./vBExternal.php'); chdir ($curdir); chdir('forums'); require_once('forums/global.php'); chdir ($curdir); ?> Quote Link to comment https://forums.phpfreaks.com/topic/112331-two-codes-at-the-very-top-conflicting/#findComment-576703 Share on other sites More sharing options...
Broleta Posted June 28, 2008 Author Share Posted June 28, 2008 Try this... <?php $curdir = getcwd (); chdir('./forums'); require_once('./vBExternal.php'); chdir ($curdir); chdir('forums'); require_once('forums/global.php'); chdir ($curdir); ?> This gives me a blank page Quote Link to comment https://forums.phpfreaks.com/topic/112331-two-codes-at-the-very-top-conflicting/#findComment-576738 Share on other sites More sharing options...
br0ken Posted June 28, 2008 Share Posted June 28, 2008 <?php error_reporting(E_ALL ^ E_NOTICE); $curdir = getcwd (); chdir('./forums'); require_once('./vBExternal.php'); chdir ($curdir); chdir('forums'); require_once('forums/global.php'); chdir ($curdir); ?> Try this and tell me if any errors are displayed. Quote Link to comment https://forums.phpfreaks.com/topic/112331-two-codes-at-the-very-top-conflicting/#findComment-576747 Share on other sites More sharing options...
Broleta Posted June 28, 2008 Author Share Posted June 28, 2008 <?php error_reporting(E_ALL ^ E_NOTICE); $curdir = getcwd (); chdir('./forums'); require_once('./vBExternal.php'); chdir ($curdir); chdir('forums'); require_once('forums/global.php'); chdir ($curdir); ?> Try this and tell me if any errors are displayed. Nope no errors still just a blank page. Quote Link to comment https://forums.phpfreaks.com/topic/112331-two-codes-at-the-very-top-conflicting/#findComment-576766 Share on other sites More sharing options...
wildteen88 Posted June 28, 2008 Share Posted June 28, 2008 I recommend you to do somehting like the following when dealing with includes: define('ROOT', $_SERVER['DOCUMENT_ROOT']); require_once ROOT . '/forums/vBExternal.php'; require_once ROOT . '/forums/globals.php'; Seems you are overcomplicating things with chdir. $_SERVER['DOCUMENT_ROOT'] returns the absolute path to your sites root. This will tell PHP to include files from the root rather than the current working directory. Quote Link to comment https://forums.phpfreaks.com/topic/112331-two-codes-at-the-very-top-conflicting/#findComment-576773 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.