I ran into the same problem, and would like to hear if there is an
elegant solution.
My solution was the following function, which I put in my app/config/
bootstrap.php and use instead of the normal vendor function.
// this function is similar to the normal vendor() function, but also
adds the vendor folder
// to the php include path
function vendor_set_path( $location )
{
$current_include_path = ini_get('include_path');
$current_includes = explode( PATH_SEPARATOR,
$current_include_path);
$args = func_get_args();
$c = func_num_args();
for ($i = 0; $i < $c; $i++) {
$arg = $args[$i];
// this location will include the actual class filename
- we want
to set the include path to the parent folder of this
$vendor_folder = dirname($arg);
if ( !$vendor_folder == '.' ){
$vendor_folder = '';
} else {
$vendor_folder .= DS;
}
if (file_exists(APP . 'vendors' . DS . $arg . '.php')) {
$vendor_path = APP . 'vendors' . DS;
} else {
$vendor_path = VENDORS;
}
if ( !in_array($vendor_path.$vendor_folder,
$current_includes) ){
$current_includes[] =
$vendor_path.$vendor_folder;
ini_set('include_path', implode( PATH_SEPARATOR,
$current_includes ) );
}
require_once($vendor_path . $arg . '.php');
}
}
On Aug 22, 9:17 pm, korcs <[EMAIL PROTECTED]> wrote:
> Hi Bakers,
>
> I am trying to include a third paryt application to my cakephp app,
> but it seems not working.
>
> The 3rd Party app has one entry file, let's say the file name is
> start.php.
>
> (The start.php includes a lot of other files from the application
> libraries and finally generates some output).
>
> I made an extra controller (ThirdPartyController) with a function
> start:
>
> function start()
> {
> vendor('3rdparty/start');
> }
>
> I get all the time file not found errors while the 3rdparty app tries
> to include its own libs.
>
> When I run the getcwd(); comand (in the 3rd party app), I get that
> the current location is '\app\webroot'.
>
> What should I do to bring the 3rdparty app working?
>
> I thought that all you should do is:
>
> 1. copy the 3rdparty app into the vendors\3rdparty directory,
> 2. create a controller for the 3rdparty app
> 3. write a function in this controller to call the 3rdparty entry
> point...
>
> What do I do wrong?
>
> Best,
>
> korcs
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---