Welcome Guest, Not a member yet? Register   Sign In
How to call library function from one library to another library
#1

[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
#2

[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();
$gallery->whatever-non-static-function()

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.
#3

[eluser]MASS MASS[/eluser]
Hi eggshape

I am using CI..........

i create class libraries same like CI format..........

Can you provide in code format............
#4

[eluser]nmweb[/eluser]
http://ellislab.com/codeigniter/user-gui...aries.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();

$CI->load->library('gallery');
$CI->gallery->do_something();
#5

[eluser]MASS MASS[/eluser]
Thank you for great support.......nmweb and eggshape

Its working




Theme © iAndrew 2016 - Forum software by © MyBB