CodeIgniter Forums
help with custom classes - 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: help with custom classes (/showthread.php?tid=44213)



help with custom classes - El Forum - 08-07-2011

[eluser]natefons[/eluser]
i read around on the forum, and it said to place custom classes in the library folder, but im not sure if that is exactly what i need to do.

i need a custom class that will in a nutshell be used more or less like a data type (if that's the right term?)
(please disregard any prebuilt classes to handle this, im using the below as an example)

lets say i have customers, they have:
a name
address
sex

i would, in regular php create a class called customers, with variables name,address,sex

now i can create numerous instances of this class as i want.
$x = new Customer();
$x2 = new Customer();

or i can place it in a for loop and create them dynamically.
for($i = .... etc etc..)
$x = new Customer()
do stuff


now how can i create a class like this in CI? can i do this in libraries?
for($i .. etc etc )
{
$x = $this->load->library('customer');
}

??

thanks for the help,
Nate


help with custom classes - El Forum - 08-11-2011

[eluser]natefons[/eluser]
any help?