CodeIgniter Forums
using a class from phpclasses.org - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: using a class from phpclasses.org (/showthread.php?tid=17614)



using a class from phpclasses.org - El Forum - 04-09-2009

[eluser]rakesh[/eluser]
hi,

i wished to use a class from phpclasses.org called snapsalbum (http://www.phpclasses.org/browse/package/5224.html), in codeigniter project.

also there is another class which i would like to use, simplehtmldom (http://sourceforge.net/projects/simplehtmldom).

could u people guide me how can i use these within codeigniter.

thank u

rakesh jangid


using a class from phpclasses.org - El Forum - 04-09-2009

[eluser]NogDog[/eluser]
You could possibly create library classes with them.


using a class from phpclasses.org - El Forum - 04-09-2009

[eluser]rakesh[/eluser]
my knoweledge is limited and i couldnt follow userguide for these perticular classes.

could u please explain specifically for above classes. how to put them in library and then how to initialise/use them in a controller.

thanks


using a class from phpclasses.org - El Forum - 04-09-2009

[eluser]NogDog[/eluser]
[quote author="rakesh" date="1239346077"]my knoweledge is limited and i couldnt follow userguide for these perticular classes.

could u please explain specifically for above classes. how to put them in library and then how to initialise/use them in a controller.

thanks[/quote]
Since I do not know those specific classes, no, I cannot.

In general, copy the class file to "<CI directory>/application/libraries/classname.php" where "classname" is the name of the class. Make sure that in the actual class file the class is named with an initial capital letter; e.g. the class is named "Myclass" while the file is "myclass.php".

Then in your controller:
Code:
$this->load->library('myclass');
// use a method from it:
$this->myclass->some_method();
Of course, this is just a synopsis of what I linked to in the users' guide, so it might not be any help.