Welcome Guest, Not a member yet? Register   Sign In
accessing base class variable
#1

[eluser]mehwish[/eluser]
hi everyone. I am new to CI and stuck in a step. I have a base class named as MY_controller in application/library folder containing the following code:
Code:
<?php


class MY_controller extends Controller{


    
    function MY_controller()
    {
        parent::controller();
    
    }


    function MY_controller_function()
    {
               $user_name='base class variable successfully accessed';
        
    }


} //end of class

?>

and also another class Form_controller in application/controller containing the following code in which i am trying to echo the user_name variable but it is not working
Code:
class Form_Controller extends MY_Controller {
  
    function Form_controller()
    {
        parent::Controller();
                
    }


function my_profile_page($data2=null)
{ echo $this->user_name;}


} end of class

Plz help me out in solving this. I have searched alot and found the sam eway to echo the value i.e., using $this->user_name but it is showing nothing


Messages In This Thread
accessing base class variable - by El Forum - 06-06-2011, 01:59 AM
accessing base class variable - by El Forum - 06-06-2011, 02:36 AM
accessing base class variable - by El Forum - 06-06-2011, 06:31 AM
accessing base class variable - by El Forum - 06-06-2011, 02:23 PM
accessing base class variable - by El Forum - 06-07-2011, 12:05 PM
accessing base class variable - by El Forum - 06-07-2011, 02:35 PM
accessing base class variable - by El Forum - 06-08-2011, 03:12 AM
accessing base class variable - by El Forum - 06-08-2011, 03:57 AM
accessing base class variable - by El Forum - 06-08-2011, 04:19 AM
accessing base class variable - by El Forum - 06-08-2011, 04:31 AM
accessing base class variable - by El Forum - 06-08-2011, 05:14 AM
accessing base class variable - by El Forum - 06-08-2011, 07:33 AM
accessing base class variable - by El Forum - 06-08-2011, 11:43 PM
accessing base class variable - by El Forum - 06-09-2011, 12:54 AM
accessing base class variable - by El Forum - 06-09-2011, 05:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB