Welcome Guest, Not a member yet? Register   Sign In
How do I reference variables from the controller into a view?
#5

[eluser]rulin[/eluser]
Hi Creator

In your controller you create an array of values and pass it to the view as the 2nd parameter
Code:
$data = array();
$data['menu'] = $menu->list;
$data['seo_keywords'] = $seo->keywords;
$this->load->view('header', $data);
$this->load->view('navi', $data);

then in you view you reference the array element as a variable
Code:
<meta name="keywords" content="<?PHP echo $seo_keywords ?>" />
and
Code:
<?PHP echo $menu ?>


Messages In This Thread
How do I reference variables from the controller into a view? - by El Forum - 03-12-2012, 06:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB