<?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"
	>
<channel>
	<title>Comments on: A View Stream with Zend_View</title>
	<atom:link href="http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/feed/" rel="self" type="application/rss+xml" />
	<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/</link>
	<description>Developing PHP and XUL Software in the Real World</description>
	<pubDate>Sun, 20 Jul 2008 14:12:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Rob...</title>
		<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20856</link>
		<dc:creator>Rob...</dc:creator>
		<pubDate>Fri, 28 Mar 2008 08:06:08 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20856</guid>
		<description>Dinoboff,

Very interesting, Thanks!

Regards,

Rob...</description>
		<content:encoded><![CDATA[<p>Dinoboff,</p>
<p>Very interesting, Thanks!</p>
<p>Regards,</p>
<p>Rob&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinoboff</title>
		<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20852</link>
		<dc:creator>Dinoboff</dc:creator>
		<pubDate>Fri, 28 Mar 2008 04:42:57 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20852</guid>
		<description>Here a version with caching:
http://code.google.com/p/simple-php-template/source/browse/trunk/src/library/Spt/Stream/View.php

It doesn't add the escape method. A subclass of Zend_View escape the variables by default instead.</description>
		<content:encoded><![CDATA[<p>Here a version with caching:<br />
<a href="http://code.google.com/p/simple-php-template/source/browse/trunk/src/library/Spt/Stream/View.php" rel="nofollow">http://code.google.com/p/simple-php-template/source/browse/trunk/src/library/Spt/Stream/View.php</a></p>
<p>It doesn't add the escape method. A subclass of Zend_View escape the variables by default instead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinoboff</title>
		<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20841</link>
		<dc:creator>Dinoboff</dc:creator>
		<pubDate>Thu, 27 Mar 2008 16:55:36 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20841</guid>
		<description>Finally, about the ternary operator:

&#60;?= @$var ? @$var : '-unknown-'; ?&#62;
&#60;?= $var ? $var : '-unknown-'; ?&#62; 

become:

&#60;?php echo $this-&#62;escape($this-&#62;var ? $this-&#62;var : '-unknown-'); ?&#62;
&#60;?php echo $this-&#62;escape($var ? $var : '-unknown-'); ?&#62;

Even if it is not really what you write, isn't it valid php?</description>
		<content:encoded><![CDATA[<p>Finally, about the ternary operator:</p>
<p>&lt;?= @$var ? @$var : '-unknown-'; ?&gt;<br />
&lt;?= $var ? $var : '-unknown-'; ?&gt; </p>
<p>become:</p>
<p>&lt;?php echo $this-&gt;escape($this-&gt;var ? $this-&gt;var : '-unknown-'); ?&gt;<br />
&lt;?php echo $this-&gt;escape($var ? $var : '-unknown-'); ?&gt;</p>
<p>Even if it is not really what you write, isn't it valid php?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinoboff</title>
		<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20840</link>
		<dc:creator>Dinoboff</dc:creator>
		<pubDate>Thu, 27 Mar 2008 16:40:46 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20840</guid>
		<description>We also need to escape result of functions:

$find = '/&#60;\?=\s*([^;]*);?\s*\?&#62;/';
$replace = &#34;&#60;?php echo \$this-&#62;escape($1); ?&#62;&#34;;
$this-&#62;data = preg_replace($find, $replace, $this-&#62;data);</description>
		<content:encoded><![CDATA[<p>We also need to escape result of functions:</p>
<p>$find = '/&lt;\?=\s*([^;]*);?\s*\?&gt;/';<br />
$replace = &quot;&lt;?php echo \$this-&gt;escape($1); ?&gt;&quot;;<br />
$this-&gt;data = preg_replace($find, $replace, $this-&gt;data);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinoboff</title>
		<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20839</link>
		<dc:creator>Dinoboff</dc:creator>
		<pubDate>Thu, 27 Mar 2008 16:33:56 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20839</guid>
		<description>Try again...
$find = '/&#60;\?=\s*(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*;?\s*\?&#62;/';
$replace = &#34;&#60;?php echo \$this-&#62;escape($1); ?&#62;&#34;;
$this-&#62;data = preg_replace($find, $replace, $this-&#62;data);</description>
		<content:encoded><![CDATA[<p>Try again&#8230;<br />
$find = '/&lt;\?=\s*(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*;?\s*\?&gt;/';<br />
$replace = &quot;&lt;?php echo \$this-&gt;escape($1); ?&gt;&quot;;<br />
$this-&gt;data = preg_replace($find, $replace, $this-&gt;data);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinoboff</title>
		<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20838</link>
		<dc:creator>Dinoboff</dc:creator>
		<pubDate>Thu, 27 Mar 2008 16:31:05 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20838</guid>
		<description>Nevermind, I had to test the solution to understand the details.

ps: make it to work I had to use the following regex:
&lt;pre class="phpcode"&gt;&lt;span style="color: #0000BB"&gt;&lt;br /&gt;$find&#160;&lt;/span&gt;&lt;span style="color: #007700"&gt;=&#160;&lt;/span&gt;&lt;span style="color: #DD0000"&gt;'//'&lt;/span&gt;&lt;span style="color: #007700"&gt;;&lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;$replace&#160;&lt;/span&gt;&lt;span style="color: #007700"&gt;=&#160;&lt;/span&gt;&lt;span style="color: #DD0000"&gt;"escape($1);&#160;?&#62;"&lt;/span&gt;&lt;span style="color: #007700"&gt;;&lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;$this&lt;/span&gt;&lt;span style="color: #007700"&gt;-&#62;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;data&#160;&lt;/span&gt;&lt;span style="color: #007700"&gt;=&#160;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;preg_replace&lt;/span&gt;&lt;span style="color: #007700"&gt;(&lt;/span&gt;&lt;span style="color: #0000BB"&gt;$find&lt;/span&gt;&lt;span style="color: #007700"&gt;,&#160;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;$replace&lt;/span&gt;&lt;span style="color: #007700"&gt;,&#160;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;$this&lt;/span&gt;&lt;span style="color: #007700"&gt;-&#62;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;data&lt;/span&gt;&lt;span style="color: #007700"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

The regex for a viriable name is from http://www.php.net/language.variables</description>
		<content:encoded><![CDATA[<p>Nevermind, I had to test the solution to understand the details.</p>
<p>ps: make it to work I had to use the following regex:</p>
<pre class="phpcode"><span style="color: #0000BB">
$find&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'//'</span><span style="color: #007700">;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$replace&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"escape($1);&nbsp;?&gt;"</span><span style="color: #007700">;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">preg_replace</span><span style="color: #007700">(</span><span style="color: #0000BB">$find</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$replace</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data</span><span style="color: #007700">);</span>
</pre>
<p>The regex for a viriable name is from <a href="http://www.php.net/language.variables" rel="nofollow">http://www.php.net/language.variables</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob...</title>
		<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20823</link>
		<dc:creator>Rob...</dc:creator>
		<pubDate>Thu, 27 Mar 2008 08:06:07 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20823</guid>
		<description>Dinoboff,

Have you example code that breaks?

Thanks,

Rob...</description>
		<content:encoded><![CDATA[<p>Dinoboff,</p>
<p>Have you example code that breaks?</p>
<p>Thanks,</p>
<p>Rob&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinoboff</title>
		<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20819</link>
		<dc:creator>Dinoboff</dc:creator>
		<pubDate>Thu, 27 Mar 2008 04:50:34 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20819</guid>
		<description>@rob: I don't think it can works because inside a loop same variables shouldn't be changed into an instance property (key and value of the array element).</description>
		<content:encoded><![CDATA[<p>@rob: I don't think it can works because inside a loop same variables shouldn't be changed into an instance property (key and value of the array element).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hendi</title>
		<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20798</link>
		<dc:creator>Hendi</dc:creator>
		<pubDate>Wed, 26 Mar 2008 13:34:29 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20798</guid>
		<description>Argh... So Wordpress also ate my post. So here's my next try:

Find the lines starting with "$find" and "$replace". In the first line, there has to be a backslash between the opening angle bracket and the first question mark and one between the asterisk and the question mark at the end.

In the second line, a backslash is needed in front of the second dollar sign (that's the one followed by "this").</description>
		<content:encoded><![CDATA[<p>Argh&#8230; So Wordpress also ate my post. So here's my next try:</p>
<p>Find the lines starting with "$find" and "$replace". In the first line, there has to be a backslash between the opening angle bracket and the first question mark and one between the asterisk and the question mark at the end.</p>
<p>In the second line, a backslash is needed in front of the second dollar sign (that's the one followed by "this").</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hendi</title>
		<link>http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20795</link>
		<dc:creator>Hendi</dc:creator>
		<pubDate>Wed, 26 Mar 2008 11:41:28 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/#comment-20795</guid>
		<description>There are some errors in your code, I blame WordPress for them, which eats backslashes.

Here is the updated part, replace ### with a backsplash:

$find = '/]*?&#124;[^;?]*?)[; ]*###?&#62;/';
$replace = "escape($1); ?&#62;";</description>
		<content:encoded><![CDATA[<p>There are some errors in your code, I blame WordPress for them, which eats backslashes.</p>
<p>Here is the updated part, replace ### with a backsplash:</p>
<p>$find = '/]*?|[^;?]*?)[; ]*###?&gt;/';<br />
$replace = "escape($1); ?&gt;";</p>
]]></content:encoded>
	</item>
</channel>
</rss>
