<?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: Note to CodeIgniter nerds: please, no looping code in your views.</title>
	<atom:link href="http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/</link>
	<description>Dedicated to teaching web designers PHP.</description>
	<lastBuildDate>Sun, 14 Mar 2010 21:44:29 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Stefan Mischook</title>
		<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/comment-page-1/#comment-100484</link>
		<dc:creator>Stefan Mischook</dc:creator>
		<pubDate>Sat, 24 Oct 2009 12:07:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/#comment-100484</guid>
		<description>&quot;I think the video you speak of is just to demonstrate how to create a basic page. It doesn’t actually use the MVC approach.&quot;

Hi,

I guess you are talking about the CodeIgniter video? 

Thanks for the comment.

Stef</description>
		<content:encoded><![CDATA[<p>&#8220;I think the video you speak of is just to demonstrate how to create a basic page. It doesn’t actually use the MVC approach.&#8221;</p>
<p>Hi,</p>
<p>I guess you are talking about the CodeIgniter video? </p>
<p>Thanks for the comment.</p>
<p>Stef</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phil</title>
		<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/comment-page-1/#comment-100471</link>
		<dc:creator>phil</dc:creator>
		<pubDate>Sat, 24 Oct 2009 10:05:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/#comment-100471</guid>
		<description>I&#039;ve just stumbled on this while looking for something else completely - but going back to the initial article:

I think the video you speak of is just to demonstrate how to create a basic page. It doesn&#039;t actually use the MVC approach.

Next, if you don&#039;t want PHP in your view (like me), then just use the parser class and keep all php away from your view.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve just stumbled on this while looking for something else completely &#8211; but going back to the initial article:</p>
<p>I think the video you speak of is just to demonstrate how to create a basic page. It doesn&#8217;t actually use the MVC approach.</p>
<p>Next, if you don&#8217;t want PHP in your view (like me), then just use the parser class and keep all php away from your view.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Weiss</title>
		<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/comment-page-1/#comment-97285</link>
		<dc:creator>Steve Weiss</dc:creator>
		<pubDate>Thu, 03 Sep 2009 05:56:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/#comment-97285</guid>
		<description>I have a bone to pick with this one... 

My designers all easily understand the concept of a loop. Often times, for various reasons, they need to drop in an extra blank table cell in the middle of every row or toss in a checkbox for this one special thing or they in some other way need to add extra stuff to the table, including manipulating the individual rows.

To be honest, when we try and abstract things out like the author suggests, it&#039;s just like so many here have already said - the designer will come back to you over and over again and ask you to change it.  It&#039;s not as simple as you make it out to be.  CSS really does not always cut it, especially in a world that still includes IE 6.  Maybe if people really do get their act together on some standards, and we get CSS3 and HTML5, and manna falls from the heavens, in a decade, perhaps, but there&#039;s a reality that trumps anything the W3C might want to dream up in this regard.  Honestly, even Safari can&#039;t do everything in CSS yet.  You simply cannot manipulate a table every which way without getting down to the row-level detail in the HTML - CSS only allows so much - not without nth-child accessors and the like, at least.  Building helpers to get around this is needlessly overcomplicated and difficult to explain to designers when they generally easily understand the concept of foreach: endforeach;, and all understand basic HTML.  I&#039;m finding it difficult to imagine the designer who can&#039;t get it, and have not had my designers &quot;bust&quot; my code anywhere near as frequently as you&#039;ve suggested.  Get SVN, and a deployment system... they shouldn&#039;t be working on your production code anyway.  If the site stops working, it&#039;s almost never their fault.</description>
		<content:encoded><![CDATA[<p>I have a bone to pick with this one&#8230; </p>
<p>My designers all easily understand the concept of a loop. Often times, for various reasons, they need to drop in an extra blank table cell in the middle of every row or toss in a checkbox for this one special thing or they in some other way need to add extra stuff to the table, including manipulating the individual rows.</p>
<p>To be honest, when we try and abstract things out like the author suggests, it&#8217;s just like so many here have already said &#8211; the designer will come back to you over and over again and ask you to change it.  It&#8217;s not as simple as you make it out to be.  CSS really does not always cut it, especially in a world that still includes IE 6.  Maybe if people really do get their act together on some standards, and we get CSS3 and HTML5, and manna falls from the heavens, in a decade, perhaps, but there&#8217;s a reality that trumps anything the W3C might want to dream up in this regard.  Honestly, even Safari can&#8217;t do everything in CSS yet.  You simply cannot manipulate a table every which way without getting down to the row-level detail in the HTML &#8211; CSS only allows so much &#8211; not without nth-child accessors and the like, at least.  Building helpers to get around this is needlessly overcomplicated and difficult to explain to designers when they generally easily understand the concept of foreach: endforeach;, and all understand basic HTML.  I&#8217;m finding it difficult to imagine the designer who can&#8217;t get it, and have not had my designers &#8220;bust&#8221; my code anywhere near as frequently as you&#8217;ve suggested.  Get SVN, and a deployment system&#8230; they shouldn&#8217;t be working on your production code anyway.  If the site stops working, it&#8217;s almost never their fault.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Mischook</title>
		<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/comment-page-1/#comment-90745</link>
		<dc:creator>Stefan Mischook</dc:creator>
		<pubDate>Wed, 03 Jun 2009 18:40:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/#comment-90745</guid>
		<description>&quot;I think if you are an HTML designer, you should have a general (if not excellent) understanding of the server side languages you are working in ...&quot;

I agree on this point 100%. That&#039;s why I created Killerphp.com in the first place:

1. To promote PHP as basic skill in web design.
2. To make learning PHP easy for designer types.

Stefan</description>
		<content:encoded><![CDATA[<p>&#8220;I think if you are an HTML designer, you should have a general (if not excellent) understanding of the server side languages you are working in &#8230;&#8221;</p>
<p>I agree on this point 100%. That&#8217;s why I created Killerphp.com in the first place:</p>
<p>1. To promote PHP as basic skill in web design.<br />
2. To make learning PHP easy for designer types.</p>
<p>Stefan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/comment-page-1/#comment-90622</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Tue, 02 Jun 2009 02:09:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/#comment-90622</guid>
		<description>I&#039;m not sure if anyone has commented on this subject, but I think this is pretty much a moot point mainly because CodeIgniter has helpers and libraries specifically for HTML generation, such as The Pagination Class, HTML Table Class, Form Helper, and HTML helper, just to name a few. CodeIgniter seems to have a lot of tools available for developers to generate portions of their HTML. I think if you are an HTML designer, you should have a general (if not excellent) understanding of the server side languages you are working in order to be able to make slight modifications if needed without breaking the whole thing (such as adding a class name or ID to something). As a developer, I also think it&#039;s important that you keep things like this in mind as your developing and provide the designer a set of classes and IDs to help make styling the HTML much easier. If you give the designer 1 variable with an entire table of data inside, he&#039;s going to come right back to you for changes or get you to put more code in the view. I think I too agree with a lot of the comments in that a lot of the code needs to go in the controller, but there&#039;s still some that is OK to put in the view. IMO.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure if anyone has commented on this subject, but I think this is pretty much a moot point mainly because CodeIgniter has helpers and libraries specifically for HTML generation, such as The Pagination Class, HTML Table Class, Form Helper, and HTML helper, just to name a few. CodeIgniter seems to have a lot of tools available for developers to generate portions of their HTML. I think if you are an HTML designer, you should have a general (if not excellent) understanding of the server side languages you are working in order to be able to make slight modifications if needed without breaking the whole thing (such as adding a class name or ID to something). As a developer, I also think it&#8217;s important that you keep things like this in mind as your developing and provide the designer a set of classes and IDs to help make styling the HTML much easier. If you give the designer 1 variable with an entire table of data inside, he&#8217;s going to come right back to you for changes or get you to put more code in the view. I think I too agree with a lot of the comments in that a lot of the code needs to go in the controller, but there&#8217;s still some that is OK to put in the view. IMO.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrei</title>
		<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/comment-page-1/#comment-83484</link>
		<dc:creator>Andrei</dc:creator>
		<pubDate>Sun, 08 Feb 2009 20:29:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/#comment-83484</guid>
		<description>Hopefully I&#039;m not too late - I had stumbled upon this discussion while searching for some MVC tuts. 

Being a front-end dev/designer (html,css, javascript), I would have to agree with Mr.Murray, and disagree with the author.

You can&#039;t limit designers by saying &quot;this is the output, deal with it.&quot; In a way, you&#039;re practically saying that your way of doing front-end (your html output) is the be-all and end-all of it, and they should simply &quot;beautify&quot; your output.

That&#039;s not the way things work, unfortunately. 

Anyone with any extensive experience with CSS and Javascript, and all the ridiculous behaviors that the different browsers throw at you when you are building complex-designed websites, know that it would be a major time-eater to keep giving the PHP developer a call saying that the code&#039;s output needs to be changed to XYZ.

It&#039;s our job to do the front-end: UI, markup, presentation, behaviors, et al; and it&#039;s your job to make things dynamic and manage the data. Most of us - the decent front-end people - can easily understand code. If your front-end people can&#039;t, then it&#039;s time you replaced them.

Honestly, It&#039;s really that simple.</description>
		<content:encoded><![CDATA[<p>Hopefully I&#8217;m not too late &#8211; I had stumbled upon this discussion while searching for some MVC tuts. </p>
<p>Being a front-end dev/designer (html,css, javascript), I would have to agree with Mr.Murray, and disagree with the author.</p>
<p>You can&#8217;t limit designers by saying &#8220;this is the output, deal with it.&#8221; In a way, you&#8217;re practically saying that your way of doing front-end (your html output) is the be-all and end-all of it, and they should simply &#8220;beautify&#8221; your output.</p>
<p>That&#8217;s not the way things work, unfortunately. </p>
<p>Anyone with any extensive experience with CSS and Javascript, and all the ridiculous behaviors that the different browsers throw at you when you are building complex-designed websites, know that it would be a major time-eater to keep giving the PHP developer a call saying that the code&#8217;s output needs to be changed to XYZ.</p>
<p>It&#8217;s our job to do the front-end: UI, markup, presentation, behaviors, et al; and it&#8217;s your job to make things dynamic and manage the data. Most of us &#8211; the decent front-end people &#8211; can easily understand code. If your front-end people can&#8217;t, then it&#8217;s time you replaced them.</p>
<p>Honestly, It&#8217;s really that simple.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Bee</title>
		<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/comment-page-1/#comment-83347</link>
		<dc:creator>Matt Bee</dc:creator>
		<pubDate>Thu, 05 Feb 2009 09:59:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/#comment-83347</guid>
		<description>I use Codeigniter regularly and what I like about it is that I have the option to either cobble together an application in almost no time by adding some PHP direct into the view files, but when I am building a larger app or working with a front end programmer to handle the views I can use the parser class, and all code is removed from the view.

Add to that a set of custom libraries and models to do my dirty work, I end up with either a very clean app, an app that was built in no time, or an app that is both!

Flexibility is the best thing any framework can give a user, from the simplest CSS framework to the biggest MVC framework.</description>
		<content:encoded><![CDATA[<p>I use Codeigniter regularly and what I like about it is that I have the option to either cobble together an application in almost no time by adding some PHP direct into the view files, but when I am building a larger app or working with a front end programmer to handle the views I can use the parser class, and all code is removed from the view.</p>
<p>Add to that a set of custom libraries and models to do my dirty work, I end up with either a very clean app, an app that was built in no time, or an app that is both!</p>
<p>Flexibility is the best thing any framework can give a user, from the simplest CSS framework to the biggest MVC framework.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan</title>
		<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/comment-page-1/#comment-83154</link>
		<dc:creator>Ivan</dc:creator>
		<pubDate>Wed, 28 Jan 2009 14:45:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/#comment-83154</guid>
		<description>Well, this post has two sides. 

On one side we have the MVC pattern which is there for a reason, and sure, we SHOULD remove as much code as possible from our Views. But I think loops aren&#039;t that big of a deal because they only serve to DISPLAY the data.

On the other side, some people argue we should format the output in the Controller and only print it in Views. Sure, this is fine for a CMS, but it doesn&#039;t really make much sense in a real world app which probably will never change it&#039;s design.

We should always stick to the DRY principle, which goes in favor of the second approach. In CakePHP we could make a new method in the AppModel called (e.g.) &quot;formatComments&quot; which would format the look of comments of (e.g.) an article and then pass it as a variable to the View, but it is resource consuming.

I guess it&#039;s all about how much time you have on your hands and what kind of project you&#039;re working on. CMS sites should stick to DRY, others, well, it&#039;s up to you :-)</description>
		<content:encoded><![CDATA[<p>Well, this post has two sides. </p>
<p>On one side we have the MVC pattern which is there for a reason, and sure, we SHOULD remove as much code as possible from our Views. But I think loops aren&#8217;t that big of a deal because they only serve to DISPLAY the data.</p>
<p>On the other side, some people argue we should format the output in the Controller and only print it in Views. Sure, this is fine for a CMS, but it doesn&#8217;t really make much sense in a real world app which probably will never change it&#8217;s design.</p>
<p>We should always stick to the DRY principle, which goes in favor of the second approach. In CakePHP we could make a new method in the AppModel called (e.g.) &#8220;formatComments&#8221; which would format the look of comments of (e.g.) an article and then pass it as a variable to the View, but it is resource consuming.</p>
<p>I guess it&#8217;s all about how much time you have on your hands and what kind of project you&#8217;re working on. CMS sites should stick to DRY, others, well, it&#8217;s up to you <img src='http://www.killerphp.com/articles/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke</title>
		<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/comment-page-1/#comment-82948</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Fri, 09 Jan 2009 15:58:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/#comment-82948</guid>
		<description>I have to disagree with the main point of this post too. I have yet to work with a designer (which should be referred to as an HTML/CSS developer in this case) that couldn&#039;t figure out how to work around and understand php and looping code in CodeIgniter views within about 15 minutes. If I have an HTML/CSS developer working on my HTML templates that can&#039;t grasp what the few PHP tags mean in the super-clean CodeIgniter views then it&#039;s time to find another developer that can</description>
		<content:encoded><![CDATA[<p>I have to disagree with the main point of this post too. I have yet to work with a designer (which should be referred to as an HTML/CSS developer in this case) that couldn&#8217;t figure out how to work around and understand php and looping code in CodeIgniter views within about 15 minutes. If I have an HTML/CSS developer working on my HTML templates that can&#8217;t grasp what the few PHP tags mean in the super-clean CodeIgniter views then it&#8217;s time to find another developer that can</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bolongsox</title>
		<link>http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/comment-page-1/#comment-78544</link>
		<dc:creator>bolongsox</dc:creator>
		<pubDate>Mon, 04 Aug 2008 15:25:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.killerphp.com/articles/note-to-codeigniter-nerds-please-no-looping-code-in-your-views/#comment-78544</guid>
		<description>If I have to prepare the whole stuff in the controller, then I can scrap the view altogether, and instead of loading view files, just print the html stuff directly from the controller to the browser... but then wasn&#039;t it like the old days of php when you can put the whole thing in ONE script , yes, ONE piece of script :p db connection, queries, html tags, and molasses of if-else and case switches... and it still works as intended as an application.
I know i don&#039;t make any point here , sorry... but here&#039;s the thing :
Using template engine is no different with putting looping code of pure php. Template engine is just another layer of php logic which parses &quot;designer friendly tags&quot; into final presentation. The logic, is still very much the same. template engine tags also has loops, and conditionals, and also prone to be broken by designers. But then, in the case of designers breaking the code, I absolutely believe that when they do so, it&#039;s a sign for me to get their replacement, heheh..
get code aware designer, it won&#039;t hurt the budget that much. If you think that code illiterate designer worth maintaining, ie: they can create venus de milo of web design, keep them, but just switch the work flow.
Let them design their masterpiece, have them weave the html+css beautifully, then let the programmer pour in the necessary code. Works all the time for me, at very least.
I use CI for some time now, and after a dozen plus projects I still see no problem in the way CI&#039;s view works. Lighten up, designers may break code, but coding in php and web is still fun because you can just refresh and see what is going wrong then fix it quickly. compare that to coding in J2ME, no designers, too many devices, programmer does breaking codes, and no nothing you can count on except System.out.println().
&quot;Presentation logic in view is good, business logic in view, bad !! &quot; ( DHH of RoR, leader of opinionated, pragmatic software... huh ? opinionated what ??? )</description>
		<content:encoded><![CDATA[<p>If I have to prepare the whole stuff in the controller, then I can scrap the view altogether, and instead of loading view files, just print the html stuff directly from the controller to the browser&#8230; but then wasn&#8217;t it like the old days of php when you can put the whole thing in ONE script , yes, ONE piece of script :p db connection, queries, html tags, and molasses of if-else and case switches&#8230; and it still works as intended as an application.<br />
I know i don&#8217;t make any point here , sorry&#8230; but here&#8217;s the thing :<br />
Using template engine is no different with putting looping code of pure php. Template engine is just another layer of php logic which parses &#8220;designer friendly tags&#8221; into final presentation. The logic, is still very much the same. template engine tags also has loops, and conditionals, and also prone to be broken by designers. But then, in the case of designers breaking the code, I absolutely believe that when they do so, it&#8217;s a sign for me to get their replacement, heheh..<br />
get code aware designer, it won&#8217;t hurt the budget that much. If you think that code illiterate designer worth maintaining, ie: they can create venus de milo of web design, keep them, but just switch the work flow.<br />
Let them design their masterpiece, have them weave the html+css beautifully, then let the programmer pour in the necessary code. Works all the time for me, at very least.<br />
I use CI for some time now, and after a dozen plus projects I still see no problem in the way CI&#8217;s view works. Lighten up, designers may break code, but coding in php and web is still fun because you can just refresh and see what is going wrong then fix it quickly. compare that to coding in J2ME, no designers, too many devices, programmer does breaking codes, and no nothing you can count on except System.out.println().<br />
&#8220;Presentation logic in view is good, business logic in view, bad !! &#8221; ( DHH of RoR, leader of opinionated, pragmatic software&#8230; huh ? opinionated what ??? )</p>
]]></content:encoded>
	</item>
</channel>
</rss>
