Jump to content

Recommended Posts

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);

?>

 

Link to comment
https://forums.phpfreaks.com/topic/112331-two-codes-at-the-very-top-conflicting/
Share on other sites

<?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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.