Welcome Guest, Not a member yet? Register   Sign In
pass variable to template file
#3

[eluser]mazdaFan[/eluser]
something like this?
Code:
<?php
class MY_Controller extends Controller {
    var $data = array();
    
    function MY_Controller()
    {
        parent::Controller();
        $this->data['menu'] = 'menu1, menu2...';
    }
    
}
and
Code:
$this->load->model(‘Products’);
//$data[‘menu’] = $this->Products->showMenu();
$this->data[‘body’] = ‘bla bla’;
$this->load->view(‘welcome_message’, $this->data);
but get error:
<p>Message: Undefined variable: menu</p>
<p>Filename: views/welcome_message.php</p>


Messages In This Thread
pass variable to template file - by El Forum - 07-06-2009, 05:35 AM
pass variable to template file - by El Forum - 07-06-2009, 05:42 AM
pass variable to template file - by El Forum - 07-06-2009, 07:21 AM
pass variable to template file - by El Forum - 07-06-2009, 07:54 AM
pass variable to template file - by El Forum - 07-06-2009, 08:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB