PDA

View Full Version : Help please! I'm clueless about chdir paths


Mikhailtech
06-21-2007, 12:37 PM
I'm trying to get "latest threads" to show up on my main site (external location from the forums) but I'm having trouble. I've done some research and it seems there are 2 ways to do this: either via hard coding, or a plugin (VBExternal seems to be the popular choice). I'm trying to get VBExternal to run and I posted in the mod thread but haven't gotten a response. I think my problem is simple, but I can't figure it out due to my lack of coding knowledge. Here's what is says I need to do to make it work:

How To Use vBExternal:

First the webpage you use it on must be php, if it is .htm/.html just re-name the extension to .php Next step is to call the file, in this example we assume that your site is: http://hello.com, and your forum is located at: http://hello.com/forums, so insert this code at the very top of our php file:

<?php
chdir('./forums');
require_once('./vBExternal.php');
?>

However, although my forum is located 1 folder deep in the root directory (public_html/forum), it's located in a sub-domain, http://forum.mikhailtech.com. I'm not sure if this has anything to do with anything, but typing ./forum doesn't seem to work. Can anyone help me out?

Lynne
06-21-2007, 02:59 PM
Basically you just need to change directories to the directory that vBExternal.php is located in. So, if your 'page' is in the same directory, then you don't need to change directories. What does your directory structure look like in regards to this page you are creating and the vBExternal.php script?

Mikhailtech
06-21-2007, 03:46 PM
The page where I want the "latest threads" to appear is located in the root folder, so /public_html/

The forum is located 1 folder deep in /public_html/forum/vBExternal.php

(however the link to the forum is http://forum.mikhailtech.com not mikhailtech.com/forum .. if that matters at all)

Go to http://www.mikhailtech.com and check out the source code near the bottom of the page. You'll find this code:

<?php
chdir('./forum');
require_once('vBExternal.php');
?> </div>

I can't figure out why it's not working though.

Lynne
06-22-2007, 03:53 AM
Ahhhh, it looks like you added that code to a template or in the middle of the page where there is already < php > tags and that is not where it needs to be added. It needs to go into the php page - in this case I guess your public_html/index.php page. If you add it to that page and you are already between the < php > tags, then you only need to add the lines beginning with "chdir" and "require_once" and that needs to be at the beginning of that page.

Mikhailtech
06-22-2007, 04:29 PM
I tried something else. I made a table at the bottom of my index.php page and put the code in there. Now when you go to http://www.mikhailtech.com and view the source (scroll down to the bottom), you'll see an empty table. The same php code is there, but it's not showing up in the source so I'm guessing it's being executed ... but no content is showing up. What else could be wrong?

Nevermind I'm an idiot ... I didn't post the optional code parts. Doh.