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

[eluser]Matalina[/eluser]
[quote author="achilleusrage" date="1331044882"]You can pass all your data in the $data var that you set when you load the
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]

[/quote]

How did the header view get $PAGE_TITLE you didn't pass it to the view?

This is how I would do it.
Code:
$data['PAGE_TITLE'] = $PAGE_TITLE;
$this->load->view("header",$data);

print $PAGE_CONTENT;

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


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