Log in

View Full Version : Can't make navbar links point to correct location


testboard
07-06-2008, 09:32 AM
I'm working on a vBulletin site that is located in a folder called "forum" & I have created a test page like this:
www.domain.com/forum/test/test.php

test.php works as expected when located in the forum folder.
However, I want to make it work from the forum/test/ folder.
I have the following code:

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'test'); // change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array('user', 'timezone', 'posting', 'cprofilefield', 'cppermission');

// pre-cache templates used by all actions
$globaltemplates = array(
'GENERIC_SHELL',
'navbar',
);

// ######################### REQUIRE BACK-END ############################
chdir('../');
require_once('./global.php');
require_once(DIR . '/includes/functions_user.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

$out = 'Test.';

// Output page:
$navbits = array();
$navbits[$parent] = 'Test';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

eval('$HTML = "' . fetch_template('test') . '";');
eval('print_output("' . fetch_template('GENERIC_SHELL') . '");');

The test template is:

<h3>$out</h3>

My problem is that the navbar does not display graphics correctly & attempts to link to the test folder. E.g. "UserCP" links to "http://www.domain.com/forum/test/usercp.php".

I've tried all sorts of things in the code.
I've checked against other php files & 3rd party applications but I'm now stumped as to what to try next.

Does anyone have any ideas on how I can make the navbar work correctly?
TIA for any advice / ideas?

Dismounted
07-06-2008, 03:24 PM
Use a HTML base element (at the top of headinclude).
<base href="http://www.domain.com/forum/" />

testboard
07-06-2008, 08:19 PM
Thanks, it worked but made all the buttons in the navbar disappear!

Something in your wording made me add a full-stop:
$headinclude .= '<base href="http://www.domain.com/forum/" />';

I guess headinclude is set in global.php or userfunctions.php.

Anyway, I'm blathering - it's all working now - Thanks very much for your help yet again :-)

Dismounted
07-07-2008, 06:36 AM
Just edit the template "headinclude". You need to add it to the top, because there is Javascript in there that have relative references.

testboard
07-12-2008, 12:55 PM
Ah, I see - thanks for that.