我的场景:
<table>
    <thead>
        <tr>
            <th>Name</th>
            <th>Email</th>
        </tr>
    </thead>
    <tbody>
        {foreach from=$users item=user}
            <tr>
                <td>{$user.name}</td>
                <td>{$user.email}</td>
            </tr>
        {foreachelse}
            There are no users....
        {/foreach}
    </tbody>
</table>
现在,当没有用户时,我的表很丑,所以我会添加:
{if $users|count > 0}
    <table>
        <thead>
            <tr>
                <th>Name</th>
                <th>Email</th>
            </tr>
        </thead>
        <tbody>
            {foreach from=$users item=user}
                <tr>
                    <td>{$user.name}</td>
                    <td>{$user.email}</td>
                </tr>
            {foreachelse}
                There are no users....
            {/foreach}
        </tbody>
    </table>
{else}
    There are no users....
{/if}
但现在我{foreachelse}的没用了。
因此,我删除了该{foreachelse} There are no users....部分并得出结论认为这{foreachelse}是无用的。
我在<table>,<ol>等中遇到的这个问题<ul>。
有没有人有解决方案,所以我可以使用{foreachelse}?
谢谢!