[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/tests/eztemplate/functions/ -> switch_loop.tpl (source)

   1  -----------
   2  
   3  {let myvar=9}
   4  {switch match=$myvar}
   5  {case match=9}
   6  ===========
   7      Match 9
   8  ===========
   9  {/case}
  10  {case match=8}
  11  ===========
  12      Match 8
  13  ===========
  14  {/case}
  15  {case}
  16  ===========
  17    Match Default
  18  ===========
  19  {/case}
  20  {/switch}
  21  {/let}
  22  
  23  -----------
  24  
  25  --------------------------
  26  
  27  {let myarr=array(1,2,3,4,5)
  28       switcherarray=array(5,6,7,8,9)}
  29  
  30  {section loop=$switcherarray var=switcher}
  31  
  32  =====
  33  switch test in let loop: {$switcher.number}
  34  =====
  35  {section show=$switcher|gt(7)}
  36  ========
  37     - switcher is greater than 7 (to be precise: {$switcher})
  38  ========
  39  {switch match=$switcher}
  40  {case match=9}
  41  ===========
  42        - switcher match 9
  43  ===========
  44  {/case}
  45  {case match=8}
  46  ===========
  47        - switcher match 8( going to check loop )
  48  ===========
  49  ================ List
  50  {section loop=$myarr var=element}
  51  
  52                  - {$element}
  53  {/section}
  54  
  55  ================
  56  {/case}
  57  {case}{*default*}
  58  ===========
  59       - Nothing matched
  60  ===========
  61    {/case}
  62    {/switch}
  63  {section-else}{*show*}
  64  ========
  65     - switcher={$switcher}
  66  ========
  67  {/section}{*show*}
  68  {/section}{*loop*}
  69  {/let}


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7