Bug Report #2

external classes

Added by danfreak - about 5 years ago. Updated over 4 years ago.

Status:Closed Start date:
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Core
Target version:2.0
Resolution:fixed Points:

Description

Add a kinda "vendor" (like in CAKEphp) folder where wo include all external classes and scripts.
In order to make it working even with complex classes with several files and folder extend the php 'include_path' directory.

I always do it with a post-controller hook:
[code]

if (!defined('BASEPATH')) exit('No direct script access allowed');

class Myclasses {
/** * includes the directory application\my_classes\ in your includes directory *
*/
function index() {
//includes the directory application\my_classes\Swift\
ini_set('include_path', ini_get('include_path').';'.BASEPATH.'application/my_classes/');
}
}

?>
[/code]

History

Updated by danfreak - almost 6 years ago

see more suggestions on this thread

Updated by Woody Gilk over 4 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

This can be accomplished as of Kohana 2.0. The syntax is:


Kohana::find_file('vendor', 'path/filename');

This will search (in this order): APPPATH, $config['include_paths'], SYSPATH.

Also available in: Atom PDF