• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to reload a custom library

#2
(05-19-2017, 04:51 AM)zashishz Wrote:
Code:
closeOrders class already loaded. Second attempt ignored.

This has nothing todo with a page reload. This means you are loading that library twice

PHP Code:
$this->load->library('closeOrders'); 

Because a resource is appended to the CI super object, you can't load a resource twice.
If you provide an alias name for a library as a third argument when loading it, CI will create a new instance of that class and append it to the super object using the provided alias.

You can also just do this
PHP Code:
$second_closeOrders_object = new closeOrders(); 

Because the file is loaded into memory you can create a new instance of the class where ever you may need it.

If you don't want to do this, and want to re-use the first instance, create a method in the library that resets it be clearing all the variables

PHP Code:
$this->closeOrders->clear($new_values); 
Reply


Messages In This Thread
How to reload a custom library - by zashishz - 05-19-2017, 04:51 AM
RE: How to reload a custom library - by Martin7483 - 05-19-2017, 05:08 AM
RE: How to reload a custom library - by zashishz - 05-24-2017, 04:47 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.