天空是蓝色的

做好软件为中国 #gcc -c helloworld.c -o helloworld.o //编译目标文件 #gcc helloworld.o -o helloworld //编译成可执行exe #helloworld //运行exe
数据加载中……
{if $smarty.section.outer.index is odd by 2}
test.tpl
<table border=1>
{section name
=outer loop=$FirstName}
{if $smarty.section.outer.index is odd by 
3}
    <tr bgcolor
="#EFEFEF"><td>
     {$smarty.section.outer.index}-{$smarty.section.outer.rownum} . {$FirstName
[outer]} {$LastName[outer]}
    </td></tr>
{else}
    <tr bgcolor
="#FFFFFFF"><td>
    {$smarty.section.outer.index}-{$smarty.section.outer.rownum} * {$FirstName
[outer]} {$LastName[outer]}
    </td></tr>
{/if}
{sectionelse}
    none
{/section}

</table>
test.php
<?php

require 'lib/Smarty-
2.6.11/libs/Smarty.class.php';

$smarty 
= new Smarty;

//$smarty->compile_check 
= true;
//$smarty->debugging = true;

//$smarty->assign(
"hello","byby");
$smarty->assign("FirstName",array("John","Mary","James","Henry","Tom","Hello"));

$smarty->display('test.tpl')
;

?>


{if $smarty.section.outer.index is odd by 1}
0 -1 * John
1 -2 . Mary
2 -3 * James
3 -4 . Henry
4 -5 * Tom
5 -6 . Hello

{if $smarty.section.outer.index is odd by 2}
0 -1 * John
1 -2 * Mary
2 -3 . James
3 -4 . Henry
4 -5 * Tom
5 -6 * Hello

{if $smarty.section.outer.index is odd by 3}
0 -1 * John
1 -2 * Mary
2 -3 * James
3 -4 . Henry
4 -5 . Tom
5 -6 . Hello

posted on 2005-12-27 16:21 bluesky 阅读(2022) 评论(1)  编辑  收藏 所属分类: 记事本

评论

# re: {if $smarty.section.outer.index is odd by 2} 2007-01-05 18:16 sdfadsf

dfasdfasdfasdfasdf
  回复  更多评论    

只有注册用户登录后才能发表评论。


网站导航: