Welcome Guest, Not a member yet? Register   Sign In
Repeating piece of code
#3

[eluser]lopetzi[/eluser]
I made a MY_Controller library:

Code:
<?php

class MY_Controller extends Controller {

    function auto()
    {
        $user = 'Guest';
        
        $general = $this->general->get_general();
        
        $template['welcome'] = 'Welcome, ' . $user;
        $template['description'] = $general->description;
        $template['keywords'] = $general->keywords;
        $template['price'] = $general->price;
    }
    
}

and now home looks like this:
Code:
<?php

class Home extends MY_Controller {

    function Home()
    {
        parent::MY_Controller();    
    }
    
    function index()
    {
        $template['heading'] = 'HOME';
        $template['title'] = 'Titlu';
        $template['left'] = $this->load->view('home','',true);
        $template['right'] = $this->load->view('newsform','',true);
    
        $this->load->view('main', $template);
        
        $this->output->enable_profiler(TRUE);
    }
}

I get errors that variables in the library are not set.
I don't know how to use the data in the library Sad

For example: how do i echo $user from the library?

Thanks


Messages In This Thread
Repeating piece of code - by El Forum - 07-15-2008, 03:01 PM
Repeating piece of code - by El Forum - 07-15-2008, 03:06 PM
Repeating piece of code - by El Forum - 07-15-2008, 04:10 PM
Repeating piece of code - by El Forum - 07-15-2008, 04:17 PM
Repeating piece of code - by El Forum - 07-16-2008, 11:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB