0

我不擅长 smarty php,所以我想就如何在下面的 foreach 之后制作“不为空”提供建议:

{foreach from=$form_fields item=form_field}
{if $form_field.caption == "Language Name" || $form_field.caption == "Tool or Technology Name" || $form_field.caption == "Area, Field, or Speciality"}

代码:

{elseif $complexField == "Languages" || $complexField == "Tool_Technology" || $complexField == "AreasOfExpertise"}
{foreach from=$complexElements key="complexElementKey" item="complexElementItem"}
       <div class="row-fluid">
     {foreach from=$form_fields item=form_field}
         {if $form_field.caption == "Language Name" || $form_field.caption == "Tool or Technology Name" || $form_field.caption == "Area, Field, or Speciality"}

           <h4>{display property=$form_field.id complexParent=$complexField complexStep=$complexElementKey}&nbsp;</h4>{else}
   <div style="display:inline">
      <label class="span4" for="slider">[[$form_field.caption]]</label>
      <div class="span8"> 
    <div class="progress progress-info progress-striped" style="margin-bottom: 9px;" rel="tooltip" title="{display property=$form_field.id complexParent=$complexField complexStep=$complexElementKey}%">
    <div class="bar" style="width: {display property=$form_field.id complexParent=$complexField complexStep=$complexElementKey}%;"></div>
    </div>
       </div>
   </div>
{/if}
{/foreach}
</div>
{/foreach}

ID l 标题 l 类型

关键技能 l 关键技能 l 复杂

Tool_Technology l Tool & Technology l complex

<< 工具与技术 >>

ToolorTechnologyName l 工具或技术名称 l 字符串

熟练度 l 熟练度 l 整数

4

1 回答 1

0

试试这个

{if $form_field.caption neq ""} 
//your code
{else}
// else part
{/if}
于 2012-10-17T11:44:40.767 回答