CodeIgniter Forums
custom Class - 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: custom Class (/showthread.php?tid=13523)



custom Class - El Forum - 11-25-2008

[eluser]hugle[/eluser]
Hello everybody.

well, as usual every day, you learn smth new Smile

Now I'm playing with my old class called - domain

so I saved the file under library directory,

renamed from
Code:
class domain {
to
Code:
class MY_domain {

then in the controller:
$this->load->library('domain');

but here is a stop for me .. How do I work now?
Yearlier my procedure was :

$domain=new domain("codeigniter.com");
echo $domain->info()."<br>";

well, i'm stuck here and don't know how to move on now Smile

Any help appreciated guys !

thanks


custom Class - El Forum - 11-25-2008

[eluser]gon[/eluser]
You only must put the MY_ when extending core CI classes.
So just rename the class back to Domain, and it should work.


custom Class - El Forum - 11-25-2008

[eluser]hugle[/eluser]
Hello
when i use: class domain {

and:
Code:
function index()
    {
        $this->load->library('domain');
        echo 'a';
    }
While accessing the controller I get blank screen.

If I rename class domain to: class MY_domain
while accessing the controller I get 'a' as expected.

Any other thoughts?