i = 0。我想在foreach中使tab1,tab2,tab3等等,並且如果i = 1,那麼在第一個< li>處回顯class =「active」。如何做到這一點?i = i + 1裏面foreach for smarty
{elseif $complexField == "KeySkills"}
<ul>
{foreach from=$complexElements key="complexElementKey" item="complexElementItem"}
{foreach from=$form_fields item=form_field}
{if $form_field.caption == "Key personal skill"}
<li
(若設爲i = 1,則回聲類= 「活性」)
><a href="#
TAB1
" data-toggle="tab">{display property=$form_field.id complexParent=$complexField complexStep=$complexElementKey} </a></li>
{/if}
{/foreach}
{/foreach}
</ul>
<div class="tab-content" style="min-height:470px;">
{foreach from=$complexElements key="complexElementKey" item="complexElementItem"}
{if $form_field.caption == "Percentaged Key Skill" || $form_field.caption == "Skill Detail"}
<div class="tab-pane fade active in" id="
TAB1" >
<div class="item_top">
<p> {display property=$form_fields.SkillDetail.id complexParent=$complexField complexStep=$complexElementKey} </p>
<div class="donutchart2" data-percent="{display property=$form_fields.PercentKeySkill.id complexParent=$complexField complexStep=$complexElementKey}"></div>
</div>
</div>
{/if}
{/foreach}
</div>
對不起。我不想tab12345。循環在{foreach}中。第一個循環是tab1。第二個循環是tab2 ... – user1732217
我附加了html代碼。 – user1732217