Welcome Guest, Not a member yet? Register   Sign In
Get variables created in MY_Controller?
#9

[eluser]chefnelone[/eluser]
I get this error:
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: company_email

Filename: controllers/mycontroller.php

Line Number: 5

if I run this code:

application/libraries/MY_Controller.php
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

    class  MY_Controller extends Controller{
    
        function __construct(){
        
        parent::Controller();

        
          $company_email = '[email protected]';
        
        }

}

application/controller/mycontroller.php
Code:
<?php
class Mycontroller extends MY_Controller {

    function index(){
        $data['company_email'] = $company_email; //this is line 5
        $this->load->view('myview', $data);
    }
    

}

application/views/myview.php
Code:
<?php echo $company_email; ?>


Messages In This Thread
Get variables created in MY_Controller? - by El Forum - 03-09-2010, 10:59 AM
Get variables created in MY_Controller? - by El Forum - 03-09-2010, 11:52 AM
Get variables created in MY_Controller? - by El Forum - 03-09-2010, 01:29 PM
Get variables created in MY_Controller? - by El Forum - 03-10-2010, 03:20 PM
Get variables created in MY_Controller? - by El Forum - 03-11-2010, 03:22 AM
Get variables created in MY_Controller? - by El Forum - 03-11-2010, 04:34 AM
Get variables created in MY_Controller? - by El Forum - 03-11-2010, 04:38 AM
Get variables created in MY_Controller? - by El Forum - 03-11-2010, 06:24 AM
Get variables created in MY_Controller? - by El Forum - 03-11-2010, 06:39 AM
Get variables created in MY_Controller? - by El Forum - 03-11-2010, 07:24 AM
Get variables created in MY_Controller? - by El Forum - 03-11-2010, 07:52 AM
Get variables created in MY_Controller? - by El Forum - 03-11-2010, 08:36 AM
Get variables created in MY_Controller? - by El Forum - 03-11-2010, 08:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB