Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling a library from inside a helpers function in Codeigniter

Tags:

Can I load a library from inside a helper?

$this->load->library('name'); 

Thanks, Max

like image 685
mistero Avatar asked Aug 30 '09 21:08

mistero


People also ask

What is difference between library and helper in CodeIgniter?

The main difference between Helper and Library in CodeIgniter is that Helper is a file with a set of functions in a particular category and is not written in Object Oriented format, while the Library is a class with a set of functions that allows creating an instance of that class and is written in Object Oriented ...

How does helper work in CodeIgniter?

They are simple, procedural functions. Each helper function performs one specific task, with no dependence on other functions. CodeIgniter does not load Helper Files by default, so the first step in using a Helper is to load it. Once loaded, it becomes globally available in your controller and views.

What is a helper in CodeIgniter How can a helper file be loaded?

To use helper files, you need to load it. Once loaded it is globally available to your controller and views. They are located at two places in CodeIgniter. CodeIgniter will look first for a helper in application/helpers folder and if not found there then it will go to system/helpers folder.

Can we load library in model CodeIgniter?

Loading the Custom LibraryUse the name of the library without “. php” extension. After loading the library, you can also call the function of that class as shown below.


1 Answers

function sendEmail() {      $CI =& get_instance();      $CI->load->library('email'); // load library  } 
like image 91
SpaceGeneral Avatar answered Oct 11 '22 14:10

SpaceGeneral