On Wed 19 Sep 2012 07:13:21 PM EDT, David Anderson wrote:
>
> It may be possible to do this by chdir()ing into html/user
> from the calling page.
> -- David
>
> On 18-Sep-2012 4:57 PM, Travis Desell wrote:
>>
>> I was wondering if there was any way to get the paths in the BOINC
>> php code
>> to use absolute paths so it can be easily accessed from other webpages
>> developed for a project that might not reside in the projects directory
>> hierarchy.
>>
>> It's kind of a mess trying to include anything from there since all
>> the paths
>> are relative and php doesn't know how to find those files. I think
>> it's as
>> simple as adding (there may be a better way to do this):
>>
>> require_once(dirname(__FILE__) . "/<whatever>");
>>
>> to the require statements. It's in some of them, but it would be great if
>> this was there uniformly over all the php.
Travis, what David suggests should work for you. I've used the following
wrapper for including BOINC libraries:
function require_boinc($libraries) {
$working_dir = getcwd();
chdir('./' . drupal_get_path('module', 'boincuser') .
'/includes/boinclib');
if (!is_array($libraries)) {
$libraries = array($libraries);
}
foreach ($libraries as $library) {
require_once("{$library}.inc");
}
chdir($working_dir);
}
Granted, this is for including code in html/inc, which may or may not be
your intent, but it works even by chdir() to a symlink to the html/inc
directory.
P.S. Another issue I ran into with this--after the includes were
working--was with the scope of global variables. In a number of places,
variables were not "global enough" to be accessed from my code, so I had
to make explicit global declarations in the BOINC libraries in order to
be able to find them.
--
Tristan Olive
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.