Welcome Guest, Not a member yet? Register   Sign In
Passing data to views called from another view
#1

[eluser]bleu[/eluser]
i have my website structure in the following fashion

My controller has
Code:
function page2($page) {
  $data['page_title'] = 'Your title for content 2';

$data['news'] = $this->news_model->get_news($page);
  
  $this->load->view('container',$data);
}


My container view has


Code:
<html>
<head>
<title>hi</title>
</head>
<body>
<?php
$this->load->view('header');
$this->load->view('menu');
$this->load->view($page);
$this->load->view('footer');
?>
</body>
</html>


Now my header and menu will have certain data that will be changing and coming from the database or being calculated.

e.g My menu will display more menu items( which it will get from the database) as per the page selected.

e.g.2 My header will have a counter which will show what work the user has done(and will bring some data from the database)(kind of like no of items selected in a shopping cart and total amount. which it may pick up from database) and even his login status. with a login form and a welcome message when he is logged in

How can I pass that data?




Messages In This Thread
Passing data to views called from another view - by El Forum - 03-06-2012, 07:28 AM
Passing data to views called from another view - by El Forum - 03-06-2012, 07:41 AM
Passing data to views called from another view - by El Forum - 03-06-2012, 07:56 AM
Passing data to views called from another view - by El Forum - 03-06-2012, 08:10 AM
Passing data to views called from another view - by El Forum - 03-06-2012, 11:06 AM
Passing data to views called from another view - by El Forum - 03-06-2012, 11:17 AM
Passing data to views called from another view - by El Forum - 03-06-2012, 01:16 PM
Passing data to views called from another view - by El Forum - 03-07-2012, 05:01 AM
Passing data to views called from another view - by El Forum - 03-07-2012, 05:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB