<?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: CodeIgniter: Organizing views simply</title>
	<atom:link href="http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html</link>
	<description></description>
	<lastBuildDate>Mon, 30 Jan 2012 06:32:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Lenka</title>
		<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/comment-page-1#comment-47978</link>
		<dc:creator>Lenka</dc:creator>
		<pubDate>Sat, 01 Oct 2011 17:51:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=48#comment-47978</guid>
		<description>I think a better approach would be to load the individual views in a superclass of a controller rather than creating a container view. Loading should be handled by a controller. This would allow e.g. loading different headers for different pages.

So in CI_Controller there could be a function

protected function loadView ($viewName, $data = NULL) {
    $this-&gt;load-&gt;helper(&#039;url&#039;);
    $this-&gt;load-&gt;view(&#039;inc_head&#039;);
    $this-&gt;load-&gt;view($viewName, $data);
}

and then in subclass you would use 

$this-&gt;loadView(&#039;home&#039;, NULL);</description>
		<content:encoded><![CDATA[<p>I think a better approach would be to load the individual views in a superclass of a controller rather than creating a container view. Loading should be handled by a controller. This would allow e.g. loading different headers for different pages.</p>
<p>So in CI_Controller there could be a function</p>
<p>protected function loadView ($viewName, $data = NULL) {<br />
    $this-&gt;load-&gt;helper(&#8216;url&#8217;);<br />
    $this-&gt;load-&gt;view(&#8216;inc_head&#8217;);<br />
    $this-&gt;load-&gt;view($viewName, $data);<br />
}</p>
<p>and then in subclass you would use </p>
<p>$this-&gt;loadView(&#8216;home&#8217;, NULL);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CodeIgniter: Organizing views simply &#124; CodeIgniter Tutorials</title>
		<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/comment-page-1#comment-39267</link>
		<dc:creator>CodeIgniter: Organizing views simply &#124; CodeIgniter Tutorials</dc:creator>
		<pubDate>Tue, 17 May 2011 10:21:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=48#comment-39267</guid>
		<description>[...] Series  andrewroland zend lucene librarycodeigniter 2.0 workshoplearncodeigniter basics  Sponsors      Top Rated TutorialsUsing Elliot Haughin&#039;s Twitter API with Codeigniter Part 2  (2 votes)CodeIgniter Active Record class and INSERT IGNORE (2 votes)Codeigniter Project Development from scratch to app Part 6  (2 votes)Tags2.0 active record ajax amplio.ch andrewroland.com api askaboutphp beginner class CMS codesamplez controller country db dragffy.com drop down egypt error flashdata form from scratch helper html index.php install jquery login lucene MVC net.tutsplus profiler reactor registration search session simplycodeigniter twitter upload URL validation variables view views workshop zend Sponsors              LinksCodeIgniter: Organizing views simply [...]</description>
		<content:encoded><![CDATA[<p>[...] Series  andrewroland zend lucene librarycodeigniter 2.0 workshoplearncodeigniter basics  Sponsors      Top Rated TutorialsUsing Elliot Haughin&#39;s Twitter API with Codeigniter Part 2  (2 votes)CodeIgniter Active Record class and INSERT IGNORE (2 votes)Codeigniter Project Development from scratch to app Part 6  (2 votes)Tags2.0 active record ajax amplio.ch andrewroland.com api askaboutphp beginner class CMS codesamplez controller country db dragffy.com drop down egypt error flashdata form from scratch helper html index.php install jquery login lucene MVC net.tutsplus profiler reactor registration search session simplycodeigniter twitter upload URL validation variables view views workshop zend Sponsors              LinksCodeIgniter: Organizing views simply [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gear Knobs </title>
		<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/comment-page-1#comment-28874</link>
		<dc:creator>Gear Knobs </dc:creator>
		<pubDate>Wed, 22 Dec 2010 18:25:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=48#comment-28874</guid>
		<description>i think that RSS FEEDS should also be included on the list of the best inventions because it makes life easier for bloggers like us -.,</description>
		<content:encoded><![CDATA[<p>i think that RSS FEEDS should also be included on the list of the best inventions because it makes life easier for bloggers like us -.,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SNG</title>
		<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/comment-page-1#comment-23677</link>
		<dc:creator>SNG</dc:creator>
		<pubDate>Sun, 08 Aug 2010 13:42:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=48#comment-23677</guid>
		<description>In our office, we have a nickname for this. We call this idea tiling. Let the master view decide where it will put the sub views. The idea presented in CI doc is more like slicing. You have to call the slices in proper order and have to decide how much goes to header and how much in footer.</description>
		<content:encoded><![CDATA[<p>In our office, we have a nickname for this. We call this idea tiling. Let the master view decide where it will put the sub views. The idea presented in CI doc is more like slicing. You have to call the slices in proper order and have to decide how much goes to header and how much in footer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: syabac</title>
		<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/comment-page-1#comment-22740</link>
		<dc:creator>syabac</dc:creator>
		<pubDate>Sat, 10 Jul 2010 04:41:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=48#comment-22740</guid>
		<description>thanks for sharing.
nice tutorial, simple and clear..</description>
		<content:encoded><![CDATA[<p>thanks for sharing.<br />
nice tutorial, simple and clear..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/comment-page-1#comment-22647</link>
		<dc:creator>David</dc:creator>
		<pubDate>Wed, 07 Jul 2010 08:31:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=48#comment-22647</guid>
		<description>hello, think for this nice trick! :)

I have add some little things :
a global class for all page datas 
and automatic passing datas to page in container :


// --- library ---

class PageDatas {
	var $titlePage=&#039;&#039;;
	var $viewPage=&#039;&#039;;
	var $datas=array();
}



so in controller I just pass this object :

// --- controller ---

$pageDatas = new PageDatas();
$pageDatas-&gt;titlePage = &#039;Tribe&#039;;

// datas contents for page
$datas[&#039;contents&#039;]=$this-&gt;ContentModel-&gt;fetchAllContents();
$pageDatas-&gt;datas =$datas; 

// view page		
$pageDatas-&gt;viewPage = &#039;content/index&#039;;
$this-&gt;load-&gt;view(&#039;layer/container&#039;, array(&#039;pageDatas&#039;=&gt;$pageDatas));


and in container I pass the pageDatas to header, footer...
and direct datas to the page :

// --- container ---

load-&gt;view(&#039;layer/header&#039;, array(&#039;pageDatas&#039;=&gt;$pageDatas)); ?&gt;

load-&gt;view($pageDatas-&gt;viewPage, $pageDatas-&gt;datas); ?&gt;


hope it can help ^^</description>
		<content:encoded><![CDATA[<p>hello, think for this nice trick! <img src='http://www.askaboutphp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I have add some little things :<br />
a global class for all page datas<br />
and automatic passing datas to page in container :</p>
<p>// &#8212; library &#8212;</p>
<p>class PageDatas {<br />
	var $titlePage=&#8221;;<br />
	var $viewPage=&#8221;;<br />
	var $datas=array();<br />
}</p>
<p>so in controller I just pass this object :</p>
<p>// &#8212; controller &#8212;</p>
<p>$pageDatas = new PageDatas();<br />
$pageDatas-&gt;titlePage = &#8216;Tribe&#8217;;</p>
<p>// datas contents for page<br />
$datas['contents']=$this-&gt;ContentModel-&gt;fetchAllContents();<br />
$pageDatas-&gt;datas =$datas; </p>
<p>// view page<br />
$pageDatas-&gt;viewPage = &#8216;content/index&#8217;;<br />
$this-&gt;load-&gt;view(&#8216;layer/container&#8217;, array(&#8216;pageDatas&#8217;=&gt;$pageDatas));</p>
<p>and in container I pass the pageDatas to header, footer&#8230;<br />
and direct datas to the page :</p>
<p>// &#8212; container &#8212;</p>
<p>load-&gt;view(&#8216;layer/header&#8217;, array(&#8216;pageDatas&#8217;=&gt;$pageDatas)); ?&gt;</p>
<p>load-&gt;view($pageDatas-&gt;viewPage, $pageDatas-&gt;datas); ?&gt;</p>
<p>hope it can help ^^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heath</title>
		<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/comment-page-1#comment-22123</link>
		<dc:creator>Heath</dc:creator>
		<pubDate>Sun, 20 Jun 2010 01:29:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=48#comment-22123</guid>
		<description>Thanks for the tut, i have only just found CI am very excited about it. I was concerned about the templating until I read your article, now I am stoked!</description>
		<content:encoded><![CDATA[<p>Thanks for the tut, i have only just found CI am very excited about it. I was concerned about the templating until I read your article, now I am stoked!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Page template in CodeIgniter &#171; CodeIgniter Lab</title>
		<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/comment-page-1#comment-21559</link>
		<dc:creator>Page template in CodeIgniter &#171; CodeIgniter Lab</dc:creator>
		<pubDate>Thu, 27 May 2010 04:50:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=48#comment-21559</guid>
		<description>[...] Ask about PHP shared their method of how to have a template with just using normal view in CodeIgniter. Their explanation was here. [...]</description>
		<content:encoded><![CDATA[<p>[...] Ask about PHP shared their method of how to have a template with just using normal view in CodeIgniter. Their explanation was here. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aziz Light</title>
		<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/comment-page-1#comment-18142</link>
		<dc:creator>Aziz Light</dc:creator>
		<pubDate>Tue, 05 Jan 2010 16:12:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=48#comment-18142</guid>
		<description>I&#039;ve been doing this for a long long time, so it seem like common knowledge for me. Nice tut anyway.

You could go one step furher though. What if you want to change the main view (the one you called &#039;container&#039;), you would have to change the name in every action of every controller where you loaded the view. Instead, what you should do is extend the Controller, and in its constructor, set the name of your main view (&#039;container&#039; in this case).

Then instead of extending Controller, you would extend MY_Controller (or whatever you called it), and when you load the view you would have someting like this:

$this-&gt;load-&gt;view($this-&gt;container, $data);

This way you can change the main view easily, and you can even go further and create a small templating engine based on that principle.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been doing this for a long long time, so it seem like common knowledge for me. Nice tut anyway.</p>
<p>You could go one step furher though. What if you want to change the main view (the one you called &#8216;container&#8217;), you would have to change the name in every action of every controller where you loaded the view. Instead, what you should do is extend the Controller, and in its constructor, set the name of your main view (&#8216;container&#8217; in this case).</p>
<p>Then instead of extending Controller, you would extend MY_Controller (or whatever you called it), and when you load the view you would have someting like this:</p>
<p>$this-&gt;load-&gt;view($this-&gt;container, $data);</p>
<p>This way you can change the main view easily, and you can even go further and create a small templating engine based on that principle.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: watanuki</title>
		<link>http://www.askaboutphp.com/48/codeigniter-organizing-views-simply.html/comment-page-1#comment-17570</link>
		<dc:creator>watanuki</dc:creator>
		<pubDate>Tue, 22 Dec 2009 13:39:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=48#comment-17570</guid>
		<description>thanks for the tips... quite useful.. ^^</description>
		<content:encoded><![CDATA[<p>thanks for the tips&#8230; quite useful.. ^^</p>
]]></content:encoded>
	</item>
</channel>
</rss>

