Part of the EllisLab Network
   
 
Undocumented arguments for views
Posted: 08 May 2008 11:26 AM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  24
Joined  12-27-2007

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:

//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/improving-codeigniters-view-handling

 Signature 

JoshGiese.com

Profile
 
 
Posted: 08 May 2008 11:48 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1261
Joined  01-07-2008

It’s documented in the loader documentation.

Also, why don’t you just load the extra view where your content_holder tag is?

//in view
<body>

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

</body>

 Signature 

Blog | Twitter | Coffee

Profile
 
 
Posted: 08 May 2008 12:49 PM   [ Ignore ]   [ # 2 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6594
Joined  03-23-2006

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.

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 09 May 2008 06:02 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  15
Joined  02-18-2008

Inparo:
if you use this->load->view inside another view, how do you pass $values from the controller to that new view??

Profile
 
 
Posted: 10 May 2008 05:43 AM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1261
Joined  01-07-2008

Any values you pass to the parent view, are automatically available in the nested views as well.

 Signature 

Blog | Twitter | Coffee

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 62793 Total Logged-in Users: 18
Total Topics: 77479 Total Anonymous Users: 0
Total Replies: 418200 Total Guests: 148
Total Posts: 495679    
Members ( View Memberlist )
Newest Members:  newbie boymarkrichesongerdyPorscheescapeexpyAnn BaileyTy BexDamien2k8cibbuser
Active Members:    bema2004swcfullerCI LeecicadessCodeSpeedCrucialDark PreacherDerek AllardDewoshjuejsdfmahutimarcossnewbie boyTien HungYuryZac G.