Part of the EllisLab Network
   
 
Problem with partial views in svn CI 1.6.1
Posted: 03 April 2008 12:31 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  209
Joined  04-25-2006

This problem exists only in the svn version of CI, not the official 1.6.1 release.

I like to use a partial view system with my projects where I load pieces of a page into a main view “skeleton” file. For example, the view file “post.php” might contain the HTML for one blog post and could be loaded several times with different data to display a full page of posts. This works fine so far as of CI 1.6.1, but a change made to the svn version breaks the technique.

According to the change log, on March 17th the function call on line 708 of Loader.php was changed from include to include_once. Among other things, this prevents partial view files with the same name from being loaded more than once per page.

I know there has been much discussion on this issue in the forums and I also realize my view organization technique is not officially supported in CI (I use a custom view library), but I’d like to report this as a potential bug regardless.

Maybe there is a way to allow the use of include for loading views and include_once for everything else?

 Signature 

My website: http://jamesgifford.com

Profile
 
 
Posted: 03 April 2008 03:29 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  285
Joined  02-13-2008

Have you filled bug report alreay?

I have the same problem. Here is the test case:

<?php
class Test extends Controller  {
    
function index(){
        
print $this->generateText('data1');
        print
$this->generateText('data2');
    
}
    
    private
function generateText($data){
         
return $this->load->view('test', array('data' => $data), true);
    
}
}
?>

I’m using this to send 4-5 notification emails at one time. They are generated from templates and each uses its own data.

Profile
 
 
Posted: 03 April 2008 11:11 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  209
Joined  04-25-2006

I haven’t filed a bug report because this doesn’t apply to an official release yet and also because the new functionality may be intentional. I just wanted to bring the issue to the attention of the developers in case they had overlooked how it would effect view files.

Also, I know a lot of people were pushing for the change to improve performance and reliability so I’m not sure what can be done to satisfy everybody. I just hope something can be done because I really don’t want to change how I handle view files.

 Signature 

My website: http://jamesgifford.com

Profile
 
 
Posted: 03 April 2008 12:26 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  285
Joined  02-13-2008

You can report SVN version bug actually.

Well… let’s wait for some official comments.

Profile
 
 
Posted: 03 April 2008 08:48 PM   [ Ignore ]   [ # 4 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  7337
Joined  03-23-2006

It wasn’t our intention to intentionally break anything.  James/Sam, if you can track down the offending include_once() and save me some time, then I’ll look at what we can do to get this fixed up.  Thanks.

 Signature 

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

Profile
MSG
 
 
Posted: 03 April 2008 11:28 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  209
Joined  04-25-2006

Hi Derek, I didn’t mean to imply that you’d intentionally break any functionality, I just wasn’t sure if this behavior was expected or not.

The include_once is on line 708 of Loader.php and I have verified that replacing it with include fixes the problem. 

Thanks for looking into the issue.

 Signature 

My website: http://jamesgifford.com

Profile
 
 
Posted: 04 April 2008 04:35 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  285
Joined  02-13-2008

I have verified it also.

Profile
 
 
Posted: 04 April 2008 05:58 AM   [ Ignore ]   [ # 7 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  7337
Joined  03-23-2006

My bad.  I didn’t mean to imply that you meant to imply that… :: group hug! ::

wink

All fixed up, thanks for reporting both.

 Signature 

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

Profile
MSG
 
 
Posted: 30 June 2009 10:26 AM   [ Ignore ]   [ # 8 ]  
Grad Student
Avatar
Rank
Total Posts:  69
Joined  09-30-2008

Hi, I’m using CI 1.7.0, If a want to “jump” to another function I receive this msg:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 178708 bytes) in /opt/lampp/htdocs/system/libraries/Loader.php on line 708

Do you know how can I solve that?

Thanks
NB

Profile
 
 
Posted: 30 June 2009 11:51 AM   [ Ignore ]   [ # 9 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  7337
Joined  03-23-2006

NB, google around for that error. It isn’t a CI thing, there just some demanding code running.

 Signature 

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

Profile
MSG
 
 
   
 
 
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 819, on March 11, 2010 11:15 AM
Total Registered Members: 120409 Total Logged-in Users: 35
Total Topics: 126512 Total Anonymous Users: 4
Total Replies: 665255 Total Guests: 351
Total Posts: 791767    
Members ( View Memberlist )