<?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: some notes on php design</title>
	<atom:link href="http://www.nivas.hr/blog/2006/10/28/76/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nivas.hr/blog/2006/10/28/76/</link>
	<description>From the Nivas crew to the galaxy of unknown</description>
	<lastBuildDate>Wed, 28 Jul 2010 09:25:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: jehutyX</title>
		<link>http://www.nivas.hr/blog/2006/10/28/76/comment-page-1/#comment-344258</link>
		<dc:creator>jehutyX</dc:creator>
		<pubDate>Fri, 11 Apr 2008 06:52:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.nivas.hr/blog/2006/10/29/76/#comment-344258</guid>
		<description>my opinion maybe sounds weird, but why do you all write so serious comments? I mean, do you REALLY think it’s true? Why? What makes you think so? Please share your opinion.</description>
		<content:encoded><![CDATA[<p>my opinion maybe sounds weird, but why do you all write so serious comments? I mean, do you REALLY think it’s true? Why? What makes you think so? Please share your opinion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seven</title>
		<link>http://www.nivas.hr/blog/2006/10/28/76/comment-page-1/#comment-1221</link>
		<dc:creator>seven</dc:creator>
		<pubDate>Mon, 20 Nov 2006 08:50:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.nivas.hr/blog/2006/10/29/76/#comment-1221</guid>
		<description>yo metapundit! Thank you very much for the response! Keep up the good work mate, there are many readers of your blog. Our blog has like 5 readers tops! Maybe after redesign we will gain some momentum. :)</description>
		<content:encoded><![CDATA[<p>yo metapundit! Thank you very much for the response! Keep up the good work mate, there are many readers of your blog. Our blog has like 5 readers tops! Maybe after redesign we will gain some momentum. <img src='http://www.nivas.hr/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: metapundit</title>
		<link>http://www.nivas.hr/blog/2006/10/28/76/comment-page-1/#comment-1134</link>
		<dc:creator>metapundit</dc:creator>
		<pubDate>Sat, 18 Nov 2006 19:14:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.nivas.hr/blog/2006/10/29/76/#comment-1134</guid>
		<description>Hey I&#039;m just happy somebody&#039;s reading the stuff I put out.  Checking my referrers and seeing who&#039;s reading and replying is half the fun of blogging... I added a link back to your blog from the article.
-regards
metapundit</description>
		<content:encoded><![CDATA[<p>Hey I&#8217;m just happy somebody&#8217;s reading the stuff I put out.  Checking my referrers and seeing who&#8217;s reading and replying is half the fun of blogging&#8230; I added a link back to your blog from the article.<br />
-regards<br />
metapundit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seven</title>
		<link>http://www.nivas.hr/blog/2006/10/28/76/comment-page-1/#comment-1117</link>
		<dc:creator>seven</dc:creator>
		<pubDate>Sat, 18 Nov 2006 14:17:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.nivas.hr/blog/2006/10/29/76/#comment-1117</guid>
		<description>&lt;font size=&quot;-1&quot;&gt;&lt;font face=&quot;Helvetica, Arial, sans-serif&quot;&gt;Hi Mate,

Thank you a lot for your comment. Cant believe you replied. :) I respect your blog, and read it on day to day basis.

I have to say, that I agree with you on every point. I am in constant search for ways to make my code more maintainable and at the moment, I am not very satisfied with maintainability of my OOP code in php and actionscript (Flash).
&lt;/font&gt;&lt;/font&gt;
But this example is very simple, and using foreach serves it&#039;s purposes.
&lt;pre&gt;
&lt;pre&gt;&lt;code&gt;$row = $db-&gt;query(&#039;select * from foo&#039;);
foreach(array(&#039;fname&#039;,&#039;lname&#039;,&#039;zip&#039;,&#039;city&#039;,&#039;state&#039;,&#039;street&#039;,&#039;zip&#039;,&#039;county&#039;) as $field)
$template-&gt;setVariable($field,$row[$field]);&lt;/code&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/pre&gt;
But, if you need to do something do data which comes from DB before you set that value to the template, (eg. stripslashes, or htmlencode, or some kind of mathematical stuff) it&#039;s impossible. In that case you will have to use longer syntax. Or you will have to develop template functions and put those primitives inside of template functions. I use smarty, so It&#039;s not much of a problem.

Best regards
Neven</description>
		<content:encoded><![CDATA[<p><font size="-1"></font><font face="Helvetica, Arial, sans-serif">Hi Mate,</p>
<p>Thank you a lot for your comment. Cant believe you replied. <img src='http://www.nivas.hr/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I respect your blog, and read it on day to day basis.</p>
<p>I have to say, that I agree with you on every point. I am in constant search for ways to make my code more maintainable and at the moment, I am not very satisfied with maintainability of my OOP code in php and actionscript (Flash).<br />
</font><br />
But this example is very simple, and using foreach serves it&#8217;s purposes.</p>
<pre>
</pre>
<pre><code>$row = $db->query('select * from foo');
foreach(array('fname','lname','zip','city','state','street','zip','county') as $field)
$template->setVariable($field,$row[$field]);</code><code>
</code></pre>
<p>But, if you need to do something do data which comes from DB before you set that value to the template, (eg. stripslashes, or htmlencode, or some kind of mathematical stuff) it&#8217;s impossible. In that case you will have to use longer syntax. Or you will have to develop template functions and put those primitives inside of template functions. I use smarty, so It&#8217;s not much of a problem.</p>
<p>Best regards<br />
Neven</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: metapundit</title>
		<link>http://www.nivas.hr/blog/2006/10/28/76/comment-page-1/#comment-1094</link>
		<dc:creator>metapundit</dc:creator>
		<pubDate>Sat, 18 Nov 2006 05:46:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.nivas.hr/blog/2006/10/29/76/#comment-1094</guid>
		<description>Well if you read the article you&#039;ll notice that I don&#039;t actually
recommend the &quot;after&quot; method in the first example. In the second
example, however, the &quot;after&quot; method is not only shorter to type the
first time, it&#039;s much more maintainable. The &quot;before&quot; method requires
you to copy and paste a line (say the bottom one) and then change
&quot;country&quot; to the name of your new field. What are the odds that you
will type

$template-&gt;setVariable(&#039;mynewfield&#039;,$row[&#039;mynewfeild&#039;]);

See the error? I bet you didn&#039;t immediately. But if you use the
&quot;after&quot; method you only need to add &#039;mynewfield&#039; to the list of column
names... There are of course advantages to succintness other than
maintainability (see Succintness = Power at
http://www.paulgraham.com/power.html ), but I&#039;m basically assuming
people agree about that already...</description>
		<content:encoded><![CDATA[<p>Well if you read the article you&#8217;ll notice that I don&#8217;t actually<br />
recommend the &#8220;after&#8221; method in the first example. In the second<br />
example, however, the &#8220;after&#8221; method is not only shorter to type the<br />
first time, it&#8217;s much more maintainable. The &#8220;before&#8221; method requires<br />
you to copy and paste a line (say the bottom one) and then change<br />
&#8220;country&#8221; to the name of your new field. What are the odds that you<br />
will type</p>
<p>$template-&gt;setVariable(&#8216;mynewfield&#8217;,$row['mynewfeild']);</p>
<p>See the error? I bet you didn&#8217;t immediately. But if you use the<br />
&#8220;after&#8221; method you only need to add &#8216;mynewfield&#8217; to the list of column<br />
names&#8230; There are of course advantages to succintness other than<br />
maintainability (see Succintness = Power at<br />
<a href="http://www.paulgraham.com/power.html" rel="nofollow">http://www.paulgraham.com/power.html</a> ), but I&#8217;m basically assuming<br />
people agree about that already&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
