語法:{if $current_item|in_array:$selected_array} ``` 2. 例子:在xoops樣板中產生星期,先準備好預設值 ``` $weekArr=[1,2,3,4...] ``` 3. 樣板檔 ``` <{section name=w start=0 loop=7 step=1}> checked="checked"<{/if}>> <{if $smarty.section.w.index==0 }><{$smarty.const._MA_JILLBOOKIN_W0}> <{elseif $smarty.section.w.index==1 }><{$smarty.const._MA_JILLBOOKIN_W1}> <{elseif $smarty.section.w.index==2 }><{$smarty.const._MA_JILLBOOKIN_W2}> <{elseif $smarty.section.w.index==3 }><{$smarty.const._MA_JILLBOOKIN_W3}> <{elseif $smarty.section.w.index==4 }><{$smarty.const._MA_JILLBOOKIN_W4}> <{elseif $smarty.section.w.index==5 }><{$smarty.const._MA_JILLBOOKIN_W5}> <{else}><{$smarty.const._MA_JILLBOOKIN_W6}> <{/if}> <{/section}> ```
$weekArr=[1,2,3,4...] ``` 3. 樣板檔 ``` <{section name=w start=0 loop=7 step=1}> checked="checked"<{/if}>> <{if $smarty.section.w.index==0 }><{$smarty.const._MA_JILLBOOKIN_W0}> <{elseif $smarty.section.w.index==1 }><{$smarty.const._MA_JILLBOOKIN_W1}> <{elseif $smarty.section.w.index==2 }><{$smarty.const._MA_JILLBOOKIN_W2}> <{elseif $smarty.section.w.index==3 }><{$smarty.const._MA_JILLBOOKIN_W3}> <{elseif $smarty.section.w.index==4 }><{$smarty.const._MA_JILLBOOKIN_W4}> <{elseif $smarty.section.w.index==5 }><{$smarty.const._MA_JILLBOOKIN_W5}> <{else}><{$smarty.const._MA_JILLBOOKIN_W6}> <{/if}> <{/section}> ```
<{section name=w start=0 loop=7 step=1}> checked="checked"<{/if}>> <{if $smarty.section.w.index==0 }><{$smarty.const._MA_JILLBOOKIN_W0}> <{elseif $smarty.section.w.index==1 }><{$smarty.const._MA_JILLBOOKIN_W1}> <{elseif $smarty.section.w.index==2 }><{$smarty.const._MA_JILLBOOKIN_W2}> <{elseif $smarty.section.w.index==3 }><{$smarty.const._MA_JILLBOOKIN_W3}> <{elseif $smarty.section.w.index==4 }><{$smarty.const._MA_JILLBOOKIN_W4}> <{elseif $smarty.section.w.index==5 }><{$smarty.const._MA_JILLBOOKIN_W5}> <{else}><{$smarty.const._MA_JILLBOOKIN_W6}> <{/if}> <{/section}> ```