Twig table 格式不正确

Twig table not formatting correctly

我觉得我在这里遗漏了一些愚蠢的东西。我渲染如下

<div class="availability_table_container">
    <table class="availability_table">
        {% for pseudo in alert.getPseudos %}
            {% for flight in alert.getFlightNumbers %}
                <tr>
                    <th class='pseudo-header'>{{ flight.getFlightNumber }}</th>
                </tr>
                <tr>
                    {% for date in alert.getAvailability %}
                        {{ date.getLastUpdated|date('d M Y H:00') }}
                    {% endfor %}
                </tr>
            {% endfor %}
        {% endfor %}
    </table>
</div>

对我来说,没有什么不对的地方。然而,我注意到我的约会对象似乎被放在了一个偏僻的地方。所以我查看了源代码,我得到了

<div class="availability_table_container">
    26 Feb 2015 12:00 26 Feb 2015 12:00 26 Feb 2015 13:00 26 Feb 2015 13:00
    <table class="availability_table">
        <tbody>
        <tr>
            <th class="pseudo-header">VS7</th>
        </tr>
        <tr></tr>
        </tbody>
    </table>
</div>

因此它已将日期放在 table 之外,而我的 table 日期应该是空的行是空的。即使我删除了这个 tr 中的 foreach 并只是输出 TEST,情况仍然是一样的。

那么为什么要在 table 之外放置任何代码?

谢谢

tr

里面加一个td
            <tr>
                {% for date in alert.getAvailability %}
                   <td> {{ date.getLastUpdated|date('d M Y H:00') }}  </td>
                {% endfor %}
            </tr>

或者其他类似的东西(这取决于你到底想要什么):

             <tr>
                <td>
                {% for date in alert.getAvailability %}
                   {{ date.getLastUpdated|date('d M Y H:00') }} 
                {% endfor %}
                 </td>
            </tr>