[ 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.tpl (source)

   1  {let myvar='derick'}
   2  
   3  {switch name=Sw1 match=$myvar}
   4  {case match='derick'}
   5  This one does match.
   6  match : {$:match}
   7  {/case}
   8  
   9  {case match='amos'}
  10  This one does not match.
  11  {/case}
  12  
  13  {case}
  14  Not this one either.
  15  {/case}
  16  {/switch}
  17  {/let}
  18  
  19  =========================================================
  20  
  21  {let myvar='amos'}
  22  
  23  {switch match=$myvar}
  24  {case match='derick'}
  25  This one doesn't match.
  26  {/case}
  27  
  28  {case match='amos'}
  29  This one does match.
  30  {$match}
  31  {/case}
  32  
  33  {case}
  34  This one doesn't match.
  35  {/case}
  36  {/switch}
  37  {/let}
  38  
  39  =========================================================
  40  
  41  {let myvar='baard'}
  42  
  43  {switch name=Sw2 var=foobar match=$myvar}
  44  {case match='derick'}
  45  This one matches.
  46  match : {$:match}
  47  {/case}
  48  
  49  {case match='amos'}
  50  This one does not match.
  51  {/case}
  52  
  53  {case}
  54  Not this one either.
  55  We were trying to find {$:foobar}
  56  {/case}
  57  {/switch}
  58  {/let}
  59  
  60  =========================================================
  61  
  62  {let my_array=array(2, 3, 4)
  63       myvar=2}
  64  {switch name=Sw3 match=$myvar}
  65  
  66  {case in=$my_array}
  67  Match : {$:match}
  68  {/case}
  69  
  70  {case}
  71  No Match for {$:match}
  72  {/case}
  73  
  74  {/switch}
  75  {/let}
  76  
  77  =========================================================
  78  
  79  {let used1=hash( section, 2 ) used2=hash( section, false() )}
  80  First({$used1.section}):
  81  
  82  {switch name=sw match=$used1.section}
  83  {case in=array(2,4,5,6,7,8,9,15)}
  84  In array
  85  {/case}
  86  {case}
  87  Not in array
  88  {/case}
  89  {/switch}
  90  
  91  Second({$used2.section}):
  92  
  93  {switch name=sw match=$used2.section}
  94  {case in=array(2,4,5,6,7,8,9,15)}
  95  In array
  96  {/case}
  97  {case}
  98  Not in array
  99  {/case}
 100  {/switch}
 101  {/let}
 102  
 103  =========================================================
 104  
 105  {let var=1}
 106  Var: {$var}
 107  Default case match:
 108  
 109  {switch name=sw match=$var}
 110  {case match=2}
 111  Value is 2
 112  {/case}
 113  {case}
 114  Default case: {$sw:match}
 115  {/case}
 116  {/switch}
 117  
 118  Empty default case match:
 119  
 120  {switch name=sw match=$var}
 121  {case match=2}
 122  Value is 2
 123  {/case}
 124  {case/}
 125  {/switch}
 126  Empty default case with space match:
 127  
 128  {switch name=sw match=$var}
 129  {case match=2}
 130  Value is 2
 131  {/case}
 132  {case   /     }
 133  {/switch}


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