smarty assign var

Standard

{assign var=”flag” value=”1″}
在Smarty手册里找了半天才找着-_-

{{foreach item=item key=key from=$List}}
{{assign var="flag" value="0"}}
  {{foreach key=key2 item=item2 from=$List_check}}
    {{if $item.id==$item2}}
      <input name="list[]" type="checkbox" value="{{$item.id}}" />{{$item.name}}
      {{assign var="flag" value="1"}}
    {{/if}}
  {{/foreach}}
{{if $flag!=1}}
  <input name="list[]" type="checkbox" value="{{$item.id}}" />{{$item.name}}
{{/if}}
{{/foreach}}

5 thoughts on “smarty assign var

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.