<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[eq相等，smarty 比较操作符！]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Wed, 04 Feb 2009 04:04:11 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	is [not] odd是否为奇，<br/>$a is not odd by $b即($a / $b) % 2 != 0 示例：<br/> &#123;if $smarty.section.outer.index is odd by 2&#125;<br/>odd英文是奇数的意思，也就是说这个能被2整除：<br/><textarea name="code" class="php" rows="15" cols="100">
&#123;section name=outer
&nbsp;&nbsp;&nbsp;&nbsp;loop=$FirstName&#125;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;if $smarty.section.outer.index is odd by 2&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;$smarty.section.outer.rownum&#125; . &#123;$FirstName[outer]&#125; &#123;$LastName[outer]&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;else&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;$smarty.section.outer.rownum&#125; * &#123;$FirstName[outer]&#125; &#123;$LastName[outer]&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;/if&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;sectionelse&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;none
&nbsp;&nbsp;&nbsp;&nbsp;&#123;/section&#125;
</textarea><br/>以上摘自smarty自己的demon。而odd则参考如下：<br/>http://zjsky1989.blog.163.com/blog/static/8158784820134632416404/<br/><br/>&#123;if $smarty.section.outer.index is odd by 1&#125;<br/><br/>0 -1 * John<br/>1 -2 . Mary<br/>2 -3 * James<br/>3 -4 . Henry<br/>4 -5 * Tom<br/>5 -6 . Hello<br/>0/1=0&nbsp;&nbsp;非奇非偶，执行else项<br/><br/>1/1=1&nbsp;&nbsp;奇数，执行if项<br/><br/>2/1=2&nbsp;&nbsp;偶数，执行else项<br/><br/>3/1=3&nbsp;&nbsp;奇数，执行if项<br/><br/>4/1=4 偶数，执行else项<br/><br/>5/1=5 奇数，执行if项<br/>来自：http://www.ithao123.cn/content-4326244.html<br/>—————————————————————————————————————————<br/><br/>eq相等，<br/>f7Y&quot;Y f3m @,V+Z &#125;4X0 ne、neq不相等，<br/>7C E z R S8P t,i:@ ^0 gt大于，<br/>4d D H4F,Yg;D X)Y0 lt小于，PHPChina 开源社区门户 T f D &amp;#124;(s P9e<br/>gte、ge大于等于，PHPChina 开源社区门户.L &amp;#124; &#92;8i-C n:Q7]<br/>lte、le 小于等于，PHPChina 开源社区门户 L8^ S &#92;;u5_ ^$n/i&quot;D<br/>not非， mod求模。 PHPChina 开源社区门户 i ^ p a S&amp;a<br/>is [not] div by是否能被某数整除，<br/>,B z M E m I w0 is [not] even是否为偶数，PHPChina 开源社区门户;J K H t&quot;g o &#123; I<br/>$a is [not] even by $b即($a / $b) % 2 == 0，PHPChina 开源社区门户#K g P e!?/k$T e k e3F<br/>is [not] odd是否为奇，PHPChina 开源社区门户 c b1^ F F e p7L<br/>$a is not odd by $b即($a / $b) % 2 != 0 示例：<br/><br/>equal/ not equal/ greater than/ less than/ less than or equal/ great than or equal/后面的就不用说了<br/><br/>Smarty 中的 if 语句和 php 中的 if 语句一样灵活易用，并增加了几个特性以适宜模板引擎. if 必须于 /if 成对出现. 可以使用 else 和 elseif 子句. 可以使用以下条件修饰词：eq、ne、neq、gt、lt、lte、le、gte、ge、is even、is odd、is not even、is not odd、not、mod、div by、even by、odd by、==、!=、&gt;、&lt;、&lt;=、&gt;=. 使用这些修饰词时必须和变量或常量用空格格开.<br/><br/>Example 7-11. if statements<br/>例 7-11. if 语句演示<br/><br/>&#123;if $name eq &quot;Fred&quot;&#125;<br/>Welcome Sir.<br/>&#123;elseif $name eq &quot;Wilma&quot;&#125;<br/>Welcome Ma&#039;am.<br/>&#123;else&#125;<br/>Welcome, whatever you are.<br/>&#123;/if&#125;<br/><br/>&#123;* an example with &quot;or&quot; logic *&#125;<br/>&#123;if $name eq &quot;Fred&quot; or $name eq &quot;Wilma&quot;&#125;<br/>...<br/>&#123;/if&#125;<br/><br/>&#123;* same as above *&#125;<br/>&#123;if $name == &quot;Fred&quot; &amp;#124;&amp;#124; $name == &quot;Wilma&quot;&#125;<br/>...<br/>&#123;/if&#125;<br/><br/>&#123;* the following syntax will NOT work, conditional qualifiers<br/>must be separated from surrounding elements by spaces *&#125;<br/>&#123;if $name==&quot;Fred&quot; &amp;#124;&amp;#124; $name==&quot;Wilma&quot;&#125;<br/>...<br/>&#123;/if&#125;<br/><br/><br/>&#123;* parenthesis are allowed *&#125;<br/>&#123;if ( $amount &lt; 0 or $amount &gt; 1000 ) and $volume &gt;= #minVolAmt#&#125;<br/>...<br/>&#123;/if&#125;<br/><br/>&#123;* you can also embed php function calls *&#125;<br/>&#123;if count($var) gt 0&#125;<br/>...<br/>&#123;/if&#125;<br/><br/>&#123;* test if values are even or odd *&#125;<br/>&#123;if $var is even&#125;<br/>...<br/>&#123;/if&#125;<br/>&#123;if $var is odd&#125;<br/>...<br/>&#123;/if&#125;<br/>&#123;if $var is not odd&#125;<br/>...<br/>&#123;/if&#125;<br/><br/>&#123;* test if var is divisible by 4 *&#125;<br/>&#123;if $var is div by 4&#125;<br/>...<br/>&#123;/if&#125;<br/><br/>&#123;* test if var is even, grouped by two. i.e.,<br/>0=even, 1=even, 2=odd, 3=odd, 4=even, 5=even, etc. *&#125;<br/>&#123;if $var is even by 2&#125;<br/>...<br/>&#123;/if&#125;<br/><br/>&#123;* 0=even, 1=even, 2=even, 3=odd, 4=odd, 5=odd, etc. *&#125;<br/>&#123;if $var is even by 3&#125;<br/>...<br/>&#123;/if&#125;
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] eq相等，smarty 比较操作符！]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>