Welcome Guest, Not a member yet? Register   Sign In
Undocumented arguments for views
#1

[eluser]Josh Giese[/eluser]
I made a blog post about how I was unhappy with CI's view handling for multiple views. I was looking for layouts that loaded views, so i turned to the "view object" from the wiki

one of my readers pointed out that I could do this instead:

Code:
//instead of displaying the view to screen, you get it’s content in $content

$alldata['title'] = “Some page variable”;

//you should have a <?=content_holder?> in your layout
$alldata['content_holder'] = $this->load->view(’content’, $content_data, true);

$this->load->view(’layout’, $alldata);

The third argument of load->view() is not documented in the user guide. Maybe I missed it, but I couldn't find it. I think it should be included, it makes things so much easier.

You can read the blog post and comments here.
http://joshhighland.com/blog/2008/04/29/...w-handling
#2

[eluser]Pascal Kriete[/eluser]
It's documented in the loader documentation.

Also, why don't you just load the extra view where your content_holder tag is?
Code:
//in view
<body>

<? $this->load->view('content'); ?>

</body>
#3

[eluser]Derek Allard[/eluser]
Hey Josh, you're right, it should be documented on the views page. If you want to take a quick stab at it, I'll add it to the manual. Sorry for the frustration.
#4

[eluser]dejitaru[/eluser]
Inparo:
if you use this->load->view inside another view, how do you pass $values from the controller to that new view??
#5

[eluser]Pascal Kriete[/eluser]
Any values you pass to the parent view, are automatically available in the nested views as well.




Theme © iAndrew 2016 - Forum software by © MyBB