![]() |
How to call library function from one library to another library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How to call library function from one library to another library (/showthread.php?tid=4967) |
How to call library function from one library to another library - El Forum - 12-27-2007 [eluser]MASS MASS[/eluser] Can anybody provide me to get library function call......... I have two library(own created)......... 1>photo 2>gallery in photo library different function .......like check,verfiy....... How to call check function in gallery library from photo library......this is my question How to call library function from one library to another library - El Forum - 12-28-2007 [eluser]eggshape[/eluser] In a standard, general way, you would include_once() or require_once() the gallery library file, and if the gallery library is a class with a nonstatic function, you instantiate the class: Code: $gallery = new Gallery(); from your photo library. If the function is a static function, use Gallery::whatever-function() and you do not need to instantiate the class (assumes your gallery library is written as a class called Gallery). For CI, you just put the libraries in your libraries directory, and load->library(gallery)...assuming this is a class. If the Gallery library is not a class and just a series of functions (similar to CodeIgniter helpers), put the file in your helpers directory, and use load->helper() if your using CI. Otherwise, include/require the file and call your function. How to call library function from one library to another library - El Forum - 12-28-2007 [eluser]MASS MASS[/eluser] Hi eggshape I am using CI.......... i create class libraries same like CI format.......... Can you provide in code format............ How to call library function from one library to another library - El Forum - 12-29-2007 [eluser]nmweb[/eluser] http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html Under 'Utilizing CodeIgniter Resources within Your Library' This can be applied to user libraries as well. In the photo library Code: $CI =& get_instance(); How to call library function from one library to another library - El Forum - 12-29-2007 [eluser]MASS MASS[/eluser] Thank you for great support.......nmweb and eggshape Its working |