views:

20

answers:

2

Ok so what I am trying to do is have multiple folders pull from one folder. So if I have this structure:

/test1/some_folder
/test2/some_folder
/test3/some_folder

I would want all of those folders named some_folder to read from a master directory. I dont need them to be able to go that specific url just need it to include the files from the main directory in each of those. Imagine I was setting up shared functions and just wanted to store them in one place but be able to include them on any site. I didnt know what to google (tried folder redirection but didnt seem right) so if anyone can offer a suggestion as to what to google or wants to provide an answer it would be appreciated.

+1  A: 

Add all of them to include_path

See also: set_include_path()

zerkms
I looked at the link that you posted. However, I need each of those folders to think that the files are in there and dont necessarily needed them included throughout the whole site. When something tries to access that directory I just need it to "link" to the other directory essentially, does this work like that? Can you do this on a shared web hosting account?
ngreenwood6
i can't get what you mean, sorry :-S at least you should be more clear in terms like "something" etc
zerkms
Sorry after looking into it further I think that is what I need. However, I have to do it in the .htaccess file. I added this line: php_value include_path ".:C:/wamp/www/awesome_site/" but it isnt using the files from that directory. Any ideas?
ngreenwood6
check if the `include_path` has been changed successfully using `get_include_path()`
zerkms
Its showing the path that I put in there but it is still pulling the files from the directory that it is in instead of the other directory.
ngreenwood6
@ngreenwood6: if they're also in the current dir, those most likely have preference in the path (usually start with `.`==current dir). If they _aren't_ in the current dir (.), then the other paths are called to action.
Wrikken
not working. I removed the index.php file from the directory and had it in the include_path directory but it just showed a directory listing instead of including it. I have a linux server I am just testing on my local machine with wampserver.
ngreenwood6
it is not working because you don't know what you want and cannot ask it properly.
zerkms
+1  A: 

If it's possible, your best bet is just using a symlink. Even most version control packages understand those. Be sure to set FollowSymlinks to true for Apache.

Wrikken
can you show me an example of how to create a symbolic link?
ngreenwood6
In standard GNU linux / unix systems: `ln -s ../path/to/source` (creates a symlinked dir or file named 'source' in the current dir) or `ln -s ../path/to/source path/to/link` (creates a symlinked dir or file in <current dir>/path/to/link). In PHP, use the `symlink()` function: http://php.net/manual/en/function.symlink.php
Wrikken
@ngreenwood6: but I see you're using Windows, I wouldn't try symlinks there..., although 5.3.0 claims to have them (_"5.3.0 This function is now available on Windows platforms (Vista, Server 2008 or greater)."_)
Wrikken