The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Defining the root directory
Hello,
I am currently working on an addon for one of my sites that doesn't encompass the global.php file from vBulletin. With that said, I am having an issue that I am hoping you all can help me with. (I have been playing and researching now for over an hour.) This is the basic structure I have: Root Sub Folder Sub Folder 2 Everything is pretty cut and dry when I am using any of my files in the root folder. The issue arises when I am in the Sub Folders. I have a new page in a sub folder that calls on the header file in the root folder. That is easy enough to get called by simply typing ../header.php. The problem though is that header.php calls on 3 files also in the root folder. Instead of including the file from the root folder, it is trying to locate the file in the sub folder, which obviously doesn't exist. How can I go about correcting this without having to duplicate the files being called? I know there is a way to define the roots directory globally, but I haven't been able to figure out how. |
#2
|
|||
|
|||
Try using the full server path on the includes or chdir to root and then chdir back if needed.
|
#3
|
||||
|
||||
Hello,
Are you suggesting I edit the files directly and add the absolute path? I am trying to avoid that. I attempted chdir but it wasn't working in the scope of how I was using it. This is my exact issue: Directory Sub Folder > Article.php Root > Header.php, Footer.php, Vars.php, Left.php Article.php calls header and footer like this: PHP Code:
header.php begins by calling on the vars.php file as the very first command, which is in the same directory as the header.php file. It is looking for that file however in the sub folder. Seeing as the header and footer files are called in every file, I was hoping that perhaps there would be a way to define globally to read from the root folder for every included file without having to edit every included file. (There are many more files that are used pending the pages usage.) What will end up happening, if i understand you correctly, is that i will need to edit almost 45 different files. If I could include a simple "scope" method for forcing the page to read from the root directory, unless otherwise defined, it would be great. I know this can be done, but i can't seem to locate HOW it is done. lol |
#4
|
|||
|
|||
Snip from http://www.php.net/manual/en/function.include.php page:
Quote:
Code:
ini_set('include_path', '.:../:./subfolder:../subfolder'); // or whatever |
#5
|
|||
|
|||
I am interested in this also.
I have two directory levels for now: www.mysite.com forum.mysite.com Since everything is installed in the /forum directory which the url forum.mysite.com points to, all calls from www.mysite.com point to stuff in the second level (/forum level). What is the best way to manage this and minimize maintenance? |
#6
|
|||
|
|||
you could create a variable with the absolute path.
Also when including files you can use DIR if global is called or CWD. DIR should be your forum path. You could put something in your initialize script like $rootDIR = "website.com/public_html/root"; Then when you need it you can call it like global $rootDIR and use that path. This way you would only edit one location to set the root. |
#7
|
||||
|
||||
Hello,
Thanks Calorie. I played with that a bit but couldn't get it to work effectively. Kungfu, that I already knew. The only problem with that is I already have massive amounts of pages created. I would need to edit each one in order to have that effective across the entire site. Instead, I created 2 new header and footer files for subdirectories to call. While developmentally it is a little odd, it serves its purpose. Those files use absolute paths, so everything is loading accordingly as they call every file directly. (Using a variable like that listed above.) |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|