0

如何使用 php 在表格中使用替代宽度?我用这种方式但得到错误。

<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td width="{if $label_payment}{echo = 50%}{else}{echo = 100%}{/if}">Shipping Address
        </td>
        <td>Payment Address
        </td>
    </tr>
    <tr>
        <td width="{if $label_payment}{echo = 50%}{else}{echo = 100%}{/if}">{$address_label_shipping}
        </td>

        {if $address_label_payment}
            <td width="50%">{$address_label_payment}
            </td>
        {if}

    </tr>
</table>

这是正确的方法吗?

{if $label_payment}{echo = 50%}{else}{echo = 100%}{/if}
4

2 回答 2

3

没有回声:

{if $label_payment}50%{else}100%{/if}

导致:

<td width="{if $label_payment}50%{else}100%{/if}">
于 2013-04-01T10:48:56.550 回答
2

试试这个...

 <td {if $label_payment}width="50%"{else}width="100%"{/if}>Shipping Address
于 2013-04-01T10:49:03.473 回答