Welcome Guest, Not a member yet? Register   Sign In
extending core/My_Classname in to application/controllers
#1

[eluser]Önder ÖZCAN[/eluser]
I just followed this official docs in ellislab web site:
http://ellislab.com/codeigniter/user-gui...asses.html

And i make the name of my Parent class in application/core :

-> /application/core/MY_Mblparent.php

Code:
class MY_Mblparent extends CI_Input
{
    public function  __construct()
    {
        parent::__construct();
        
    }

-> /application/controllers/test.php

Code:
class test extends MY_Mblparent
{
      public function  __construct()
      {
         parent::__construct();
         $this->setData=array();
      }
......

Fatal error: Class 'MY_Mblparent' not found in /Applications/MAMP/htdocs/avea/application/controllers/test.php on line 9

........

According to documentation, everything is so easy and so simple ! but like mostly other Helpers and classes , CI has tons of missing part and does not supply full automation helpers ( Like Pagination .. )

Anyone has any idea , whats wrong here? ( Any trick how to hack and makes it work ? )
#2

[eluser]apodner[/eluser]
It seems like you are trying to extend the CI_Input class.


If that is the case, you should name your class as follows
Code:
/* filename: /application/core/MY_Input.php */

class MY_Input extends CI_Input
{
    public function __construct()
    {
        parent::__construct();
    }

    public function someMethodName()
    {
         /*do something cool*/
    }
}


then for the controller:

Code:
class test extends CI_Controller
{
    public function index()
    {
       /*some code*/
       $this->input->someMethodName();
    }

}
#3

[eluser]Aken[/eluser]
You also never extend a library or core file other than CI_Controller (or an appropriate extended controller like MY_Controller), when creating your controller files. It simply won't work.




Theme © iAndrew 2016 - Forum software by © MyBB