不是空的然后'在foreach之后

时间:2012-10-17 11:09:25

标签: php foreach smarty

我在smarty php中表现不佳所以我想建议如何在下面的foreach之后制作一个'is not empty then':

{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"}

CODE:

{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输入

KeySkills l Key Skills l complex

Tool_Technology l Tool&amp;技术复杂

&LT;&LT;工具&amp;技术&gt;&gt;

ToolorTechnologyName l工具或技术名称l string

熟练程度l熟练程度l整数

1 个答案:

答案 0 :(得分:0)

试试这个

{if $form_field.caption neq ""} 
//your code
{else}
// else part
{/if}