• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variables

#1
[eluser]Perkin5[/eluser]
I have seen other posts relating to similar problems but none of them got an answer that works.

I am a beginner with codeigniter, using version 2.0.2 with php 5.3.

I am testing with a controller called start.php and the code is:

Code:
<?php  

class Start extends CI_Controller
{
    var $base;
    function _construct()
    {
        parent::_construct();
        $this->base = $this->config->item('base_url');
    }    
    function hello()
    {
        $data['base'] = $this->base;
        print_r ($data);
    }
    
    
}

When I go to the hello function in the browser, the print_r function shows that $data is empty (like this: Array ( [base] => ) ). Why is the value set for $this->base in the constructor not available in the hello method? I have now spent about 8 hours on this one issue without success.


Messages In This Thread
Variables - by El Forum - 06-20-2011, 09:50 AM
Variables - by El Forum - 06-20-2011, 11:03 AM
Variables - by El Forum - 06-20-2011, 11:27 AM
Variables - by El Forum - 06-20-2011, 11:33 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.