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

[eluser]achilleusrage[/eluser]
You can pass all your data in the $data var that you set when you load the 'container' view.

For example, I do something similar to what you are doing:

Controller:
Code:
function index()
{
   $data["PAGE_TITLE"] = "This is the HTML title of my page";
   $data["PAGE_CONTENT"] = "This is the content of my page.";
   $this->load->view("container",$data);
}

Views:

container view:
Code:
$this->load->view("header");

print $PAGE_CONTENT;

$this->load->view("footer");

header view:

<html>
<head>
<title><?php print $PAGE_TITLE; ?></title>
</head>
<body>
[/code]

Hope this helps!



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