Welcome Guest, Not a member yet? Register   Sign In
rookie problem
#1

[eluser]mortifrog[/eluser]
Hi, I've been using PHP quite successfully for a number of years but am new to OO and programming with any sort of framework. I think if I can crack this CI methodology, I will be on fire, but so far I'm just managing the odd spark!

Can someone tell what's wrong with the following code please?

Code:
class Welcome extends Controller {
    
var $content;

    function Welcome()
    {
        parent::Controller();
            
        $this->content='q_content';
        
    }
    
    function index()
    {
        echo $this->content; # this works
        $this->load->view('q_page_open');
          $this->load->view($this->$content); # this doesn't - why?
        $this->load->view('q_page_close');
    }
}

CI gives me an error of: Undefined variable: content

and PHP chucks up - Cannot access empty property in ....

It seems to me as if I have defined a property named q_page and am asking to load it's contents as a view? I know I must be being dim, but I'm too dim on this occasion to work out why!


Messages In This Thread
rookie problem - by El Forum - 12-17-2008, 06:44 AM
rookie problem - by El Forum - 12-17-2008, 07:04 AM
rookie problem - by El Forum - 12-17-2008, 07:10 AM
rookie problem - by El Forum - 12-17-2008, 07:14 AM
rookie problem - by El Forum - 12-17-2008, 08:41 AM
rookie problem - by El Forum - 12-17-2008, 10:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB