这是我的代码,我需要停止预告最后的ul和tab-content永久使用smarty 2
<div class="tabs">
<ul class="nav nav-tabs">
{foreach from=$languages item=v}
<li>
<a href="#tab_1">Example</a>
</li>
// --> I Want stop this two
<ul>
<div class="tab-content">
// I Want stop this two <---
<div class="tab-pane fade" id="tab_1">
<p>Example text</p>
</div>
</div>
{/foreach}
</div>
答案 0 :(得分:0)
您可以使用{break}语句执行此操作。例如
{$data = [1,2,3,4,5]}
{foreach $data as $value}
{if $value == 3}
{* abort iterating the array *}
{break}
{/if}
{$value}
{/foreach}
{*
prints: 1 2
*}