PDA

View Full Version : Chdir/$vbulletin->options['homeurl'] trouble.


NickyDee
09-02-2008, 01:47 PM
Im trying to make a frontpage for my website that uses elements like the navbar, header, headerinclude and footer. The file layout is

/index.php
-- /forum

I've got it sort of working but the problem is my navbar links are going to /root when they should be redirected to /forum/... Heres the page that I'm talking about: http://www.study-medicine.co.uk/index.php

I'm using this code in my php to change directory:

$cwd = getcwd();
chdir('/kunden/homepages/44/d254237426/htdocs/forum');
require_once('global.php');
chdir($cwd);

And I've put the code below in front of the relative links for the FAQ to test it:

$vbulletin->options['homeurl']

But when it generates the page I get the link "http://www.study-medicine.co.uk/Array['homeurl']/faq.php"

So its not converting that homeurl into the homeurl. Its probably quite apparent my knowledge of php is on the slim side, really struggling to see what the next step is here.

Thanks for your help, much appreciated. Been working on this for the last 12 hours solid.

--------------- Added 1220367731 at 1220367731 ---------------

I notice the page is also showing the "Loaded but with errors" icon in the bottom left of IE7.

Marco van Herwaarden
09-02-2008, 02:15 PM
Does your script require you the chdir() back to the original directory? If not try leaving the script with the forumhome as current directory.

Lynne
09-02-2008, 02:19 PM
I have a similar setup - an index.php page and then a forum directory. Unfortunatley, my way of dealing with this was to modify the navbar and add "$vboptions[bburl]/" in front of every link. I also had to modify the headerinclude in a similar way. I also made a new footer template without the $cron image just to use on that index.php page. I'm sure there must be a better way, but that's how I did it way back on 3.0 and I haven't changed my basic method.

NickyDee
09-02-2008, 03:25 PM
Does your script require you the chdir() back to the original directory? If not try leaving the script with the forumhome as current directory.

Yeah, it requires it.

Marco van Herwaarden
09-02-2008, 03:39 PM
Then you will need to ensure your templates use absolute URLs.

NickyDee
09-02-2008, 03:47 PM
I've changed them now to include the /forum/ prefix which seems to be working. Thanks for your help. Its a shame really there isn't a more inbuilt function for this as its a very common setup.

Dismounted
09-03-2008, 06:25 AM
You can just add a base element to the top of headinclude, no need to do all that link editing.
<base href="http://www.yoursite.com/forum/" />