自定义了一个多选字段,选择了颜色显示,不选择颜色不显示。
{volist name=":explode(',',$info.color_yanse)" id="name" } <ul class="list-unstyled available--colors mb-50"> {if $name==1}<li><a><span class="silver"></span>Silver</a></li>{/if} {if $name==2}<li><a><span class="black"></span>black</a></li>{/if} {if $name==3}<li><a><span class="gold"></span>Gold</a></li>{/if} {if $name==4}<li><a><span class="white"></span>White</a></li>{/if} {if $name==5}<li><a><span class="gray"></span>Gray</a></li>{/if} {if $name==6}<li><a><span class="blue"></span>Blue</a></li>{/if} {if $name==7}<li><a><span class="red"></span>Red</a></li>{/if} </ul> {/volist}
参考这个帖子弄的。
{volist name=":explode(',',$info['_color_yanse'])" id="name"} {switch $name} {case value = '1'}一{/case} {case value = '2'}二{/case} {case value = '3'}三{/case} {case value = '4'}四{/case} {default /} {/switch} {/volist}
自己参考着修改
改成这样,还是不行。。。。
{volist name=":explode('、',$info.color_yanse)" id="name"} {switch $name} {case value = 'silver'}<li><a><span class="silver"></span>GREY</a></li>{/case} {case value = 'black'}<li><a><span class="black"></span>black</a></li>{/case} {case value = 'gold'}<li><a><span class="gold"></span>GOLD</a></li>{/case} {case value = 'white'}<li><a><span class="white"></span>WHITE</a></li>{/case} {case value = 'gray'}<li><a><span class="gray"></span>GREY</a></li>{/case} {case value = 'blue'}<li><a><span class="blue"></span>BLUE</a></li>{/case} {case value = 'red'}<li><a><span class="red"></span>RED</a></li>{/case} {default /} {/switch} {/volist}