<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Improving CodeIgniters View Handling</title>
	<atom:link href="http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/feed/" rel="self" type="application/rss+xml" />
	<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/</link>
	<description>the living internet</description>
	<lastBuildDate>Mon, 14 May 2012 13:25:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Tahsin Hasan</title>
		<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/comment-page-1/#comment-48436</link>
		<dc:creator>Tahsin Hasan</dc:creator>
		<pubDate>Mon, 04 Oct 2010 07:08:38 +0000</pubDate>
		<guid isPermaLink="false">http://joshhighland.com/blog/?p=279#comment-48436</guid>
		<description>Hello,

get the advanced layout library on codeigniter on &lt;a href=&quot;http://newdailyblog.blogspot.com/2010/07/codeigniter-advanced-layout-library.html&quot; rel=&quot;nofollow&quot;&gt;tahsin&#039;s garage&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>get the advanced layout library on codeigniter on <a href="http://newdailyblog.blogspot.com/2010/07/codeigniter-advanced-layout-library.html" rel="nofollow">tahsin&#8217;s garage</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam IT</title>
		<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/comment-page-1/#comment-41393</link>
		<dc:creator>Sam IT</dc:creator>
		<pubDate>Mon, 23 Aug 2010 18:44:19 +0000</pubDate>
		<guid isPermaLink="false">http://joshhighland.com/blog/?p=279#comment-41393</guid>
		<description>While Codeigniter is truly a great framework (which I work with every day) I think it has a lot of other weaknesses that are probably a bit more important that views.

I&#039;m not going to explain too much about those weaknesses, mainly because most of those weaknesses may not be practical for some (if not most) users but just to give you an idea:

* You cannot &quot;extend&quot; the bootstrap process.
* The controller/router/CI_Base are coupled badly, something that for example, prevents from loading multiple controllers.

I have never used the &quot;View Object&quot; class. I think it&#039;s a good idea and that the implementation that be improved a bit.

For example:

When you use the standard CI views and you use an undeclared variable, a notice will be issued by PHP and may or may not be printer to the screen and/or a file.

When you use this class, it seems to me (just by reading the code, I have never used it and hope that I&#039;m correct) that you can easily cause your application to die because you&#039;re calling an undeclared method (rather than a variable).

To make things a bit clear:

* Standard views:  &lt;-- will issue a warning/notice;

* &quot;View Object&quot;: render() ?&gt; &lt;-- will exit;

This could be solved by using PHP&#039;s &quot;magic methods&quot;. __get() and __set() would be a good start.

Also, another quick way is to use the __to_string() magic method so that in the views, you don&#039;t need to call the render() method. You can simply echo the variable. The rest will be done internally.

The only issue (I see) with those suggestions is that they&#039;re PHP-5 specific but in general, I think I&#039;m gonna start using the View Object class.</description>
		<content:encoded><![CDATA[<p>While Codeigniter is truly a great framework (which I work with every day) I think it has a lot of other weaknesses that are probably a bit more important that views.</p>
<p>I&#8217;m not going to explain too much about those weaknesses, mainly because most of those weaknesses may not be practical for some (if not most) users but just to give you an idea:</p>
<p>* You cannot &#8220;extend&#8221; the bootstrap process.<br />
* The controller/router/CI_Base are coupled badly, something that for example, prevents from loading multiple controllers.</p>
<p>I have never used the &#8220;View Object&#8221; class. I think it&#8217;s a good idea and that the implementation that be improved a bit.</p>
<p>For example:</p>
<p>When you use the standard CI views and you use an undeclared variable, a notice will be issued by PHP and may or may not be printer to the screen and/or a file.</p>
<p>When you use this class, it seems to me (just by reading the code, I have never used it and hope that I&#8217;m correct) that you can easily cause your application to die because you&#8217;re calling an undeclared method (rather than a variable).</p>
<p>To make things a bit clear:</p>
<p>* Standard views:  < -- will issue a warning/notice;</p>
<p>* "View Object": render() ?> <&#8211; will exit;</p>
<p>This could be solved by using PHP&#8217;s &#8220;magic methods&#8221;. __get() and __set() would be a good start.</p>
<p>Also, another quick way is to use the __to_string() magic method so that in the views, you don&#8217;t need to call the render() method. You can simply echo the variable. The rest will be done internally.</p>
<p>The only issue (I see) with those suggestions is that they&#8217;re PHP-5 specific but in general, I think I&#8217;m gonna start using the View Object class.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: buzzknow</title>
		<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/comment-page-1/#comment-31751</link>
		<dc:creator>buzzknow</dc:creator>
		<pubDate>Wed, 16 Jun 2010 09:40:26 +0000</pubDate>
		<guid isPermaLink="false">http://joshhighland.com/blog/?p=279#comment-31751</guid>
		<description>anyway, how to create simple dynamic page title in code igniter?

thanks</description>
		<content:encoded><![CDATA[<p>anyway, how to create simple dynamic page title in code igniter?</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Code Igniter Layout Plugins &#171; fwdir.com</title>
		<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/comment-page-1/#comment-1926</link>
		<dc:creator>Code Igniter Layout Plugins &#171; fwdir.com</dc:creator>
		<pubDate>Mon, 05 Jan 2009 20:36:47 +0000</pubDate>
		<guid isPermaLink="false">http://joshhighland.com/blog/?p=279#comment-1926</guid>
		<description>[...] http://codeigniter.com/wiki/layout_library/ Cake-like layout library for Code Igniter. Having a link in the Wiki may make it appear to be an official library, but it is not at all endorsed by Code Igniter. It is a simple method, and works quite well. [...]</description>
		<content:encoded><![CDATA[<div style="">
<p>[...] <a href="http://codeigniter.com/wiki/layout_library/" rel="nofollow">http://codeigniter.com/wiki/layout_library/</a> Cake-like layout library for Code Igniter. Having a link in the Wiki may make it appear to be an official library, but it is not at all endorsed by Code Igniter. It is a simple method, and works quite well. [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: John_Betong</title>
		<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/comment-page-1/#comment-1506</link>
		<dc:creator>John_Betong</dc:creator>
		<pubDate>Fri, 09 May 2008 05:12:50 +0000</pubDate>
		<guid isPermaLink="false">http://joshhighland.com/blog/?p=279#comment-1506</guid>
		<description>My previous comment did not display correctly so here is the online version which hopefully shows the URL:

johns-jokes.com/downloads/template_joshhighland.txt</description>
		<content:encoded><![CDATA[<p>My previous comment did not display correctly so here is the online version which hopefully shows the URL:</p>
<p>johns-jokes.com/downloads/template_joshhighland.txt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John_Betong</title>
		<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/comment-page-1/#comment-1505</link>
		<dc:creator>John_Betong</dc:creator>
		<pubDate>Fri, 09 May 2008 04:20:38 +0000</pubDate>
		<guid isPermaLink="false">http://joshhighland.com/blog/?p=279#comment-1505</guid>
		<description>Initially I had similar problems with the HTML block statements. 

Now I let CodeIgniter generate &quot;self contained block statement strings&quot; which are used in the following template/view.php




  
  
   div {border:dotted 0px} /* DEBUG 1px */
  



  
  	
  
  	
  

    
      &lt;
    
    
    
      
      

    
      &lt;
    

    
      
    

  
  
  


</description>
		<content:encoded><![CDATA[<p>Initially I had similar problems with the HTML block statements. </p>
<p>Now I let CodeIgniter generate &#8220;self contained block statement strings&#8221; which are used in the following template/view.php</p>
<p>   div {border:dotted 0px} /* DEBUG 1px */</p>
<p>      &lt;</p>
<p>      &lt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Highland</title>
		<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/comment-page-1/#comment-1504</link>
		<dc:creator>Josh Highland</dc:creator>
		<pubDate>Thu, 08 May 2008 16:16:06 +0000</pubDate>
		<guid isPermaLink="false">http://joshhighland.com/blog/?p=279#comment-1504</guid>
		<description>Alex, i tried out your approach, and it works great! no need to load extra code or anything. 

This is a great discovery. I wonder why it is not documented!</description>
		<content:encoded><![CDATA[<p>Alex, i tried out your approach, and it works great! no need to load extra code or anything. </p>
<p>This is a great discovery. I wonder why it is not documented!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/comment-page-1/#comment-1497</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Mon, 05 May 2008 16:21:29 +0000</pubDate>
		<guid isPermaLink="false">http://joshhighland.com/blog/?p=279#comment-1497</guid>
		<description>Honestly, I don&#039;t remember. I&#039;ve used CI a while ago, and this way of managing views made more sense to me than the way CakePHP did it (back then, because I haven&#039;t tried it since).

The CI user guide is one of the best, but even so, the user forum adds a lot of good information. If you search there i&#039;m sure you&#039;ll find some interesting pieces of code that are not present in the user guide (actually it makes sense to have a clean user guide that gets you started without adding to much complexity)</description>
		<content:encoded><![CDATA[<p>Honestly, I don&#8217;t remember. I&#8217;ve used CI a while ago, and this way of managing views made more sense to me than the way CakePHP did it (back then, because I haven&#8217;t tried it since).</p>
<p>The CI user guide is one of the best, but even so, the user forum adds a lot of good information. If you search there i&#8217;m sure you&#8217;ll find some interesting pieces of code that are not present in the user guide (actually it makes sense to have a clean user guide that gets you started without adding to much complexity)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Highland</title>
		<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/comment-page-1/#comment-1496</link>
		<dc:creator>Josh Highland</dc:creator>
		<pubDate>Mon, 05 May 2008 00:42:32 +0000</pubDate>
		<guid isPermaLink="false">http://joshhighland.com/blog/?p=279#comment-1496</guid>
		<description>thats interesting, looking at the user guide, http://codeigniter.com/user_guide/general/views.html , the third parameter you mention is not documented. how did you come across it? I wonder why its not in the user guide.</description>
		<content:encoded><![CDATA[<p>thats interesting, looking at the user guide, <a href="http://codeigniter.com/user_guide/general/views.html" rel="nofollow">http://codeigniter.com/user_guide/general/views.html</a> , the third parameter you mention is not documented. how did you come across it? I wonder why its not in the user guide.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://joshhighland.com/blog/2008/04/29/improving-codeigniters-view-handling/comment-page-1/#comment-1494</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sun, 04 May 2008 15:28:42 +0000</pubDate>
		<guid isPermaLink="false">http://joshhighland.com/blog/?p=279#comment-1494</guid>
		<description>Well, you can. Create a view template for the &#039;layout&#039; with all the common data. Add print variables for the different dynamic areas.

Then, load some other views in some temporary variables, instead of echoing them (use the third parameter of load view with a value of &quot;true&quot;).

Use the temporary variables as the data used to display the &#039;layout&#039;.

Ex:
$content = $this-&gt;load-&gt;view(&#039;content&#039;,$content_data,true);//instead of displaying the view to screen, you get it&#039;s content in $content
$alldata[&#039;title&#039;] = &quot;Some page variable&quot;;
$alldata[&#039;content_holder&#039;] = $content;//you should have a &lt;?=content_holder?&gt; in your layout
$this-&gt;load-&gt;view(&#039;layout&#039;,$alldata);

Sorry if my explanation is not very clear.</description>
		<content:encoded><![CDATA[<p>Well, you can. Create a view template for the &#8216;layout&#8217; with all the common data. Add print variables for the different dynamic areas.</p>
<p>Then, load some other views in some temporary variables, instead of echoing them (use the third parameter of load view with a value of &#8220;true&#8221;).</p>
<p>Use the temporary variables as the data used to display the &#8216;layout&#8217;.</p>
<p>Ex:<br />
$content = $this-&gt;load-&gt;view(&#8216;content&#8217;,$content_data,true);//instead of displaying the view to screen, you get it&#8217;s content in $content<br />
$alldata['title'] = &#8220;Some page variable&#8221;;<br />
$alldata['content_holder'] = $content;//you should have a &lt;?=content_holder?&gt; in your layout<br />
$this-&gt;load-&gt;view(&#8216;layout&#8217;,$alldata);</p>
<p>Sorry if my explanation is not very clear.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 1/23 queries in 0.148 seconds using disk: basic
Object Caching 388/406 objects using disk: basic
Content Delivery Network via Amazon Web Services: S3: joshhighland.com.s3.amazonaws.com

Served from: joshhighland.com @ 2012-05-21 04:50:23 -->
