【发布时间】:2017-11-05 13:08:29
【问题描述】:
我正在使用 WHMCS 7.x 并且 Smarty PHP 已经启用。
我想在产品名称下方的客户区产品 (clientareaproducts.tpl) 中显示一个自定义字段,该字段已经存在并且填充了 IP 地址(该自定义字段的聪明 PHP 代码是 {$service_custom_fields.4} ) 而不是 $service.domain。
以下是 clientareaproducts.tpl 文件:
{include file="$template/includes/tablelist.tpl" tableName="ServicesList" filterColumn="3"}
<script type="text/javascript">
{if $orderby == 'product'}
table.order([0, '{$sort}'], [3, 'asc']);
{elseif $orderby == 'amount' || $orderby == 'billingcycle'}
table.order(1, '{$sort}');
{elseif $orderby == 'nextduedate'}
table.order(2, '{$sort}');
{elseif $orderby == 'domainstatus'}
table.order(3, '{$sort}');
{/if}
table.draw();
jQuery('#tableLoading').addClass('hidden');
});
</script>
<div class="table-container clearfix">
<table id="tableServicesList" class="table table-list hidden">
<thead>
<tr>
<th>{$LANG.orderproduct}</th>
<th>{$LANG.clientareaaddonpricing}</th>
<th>{$LANG.clientareahostingnextduedate}</th>
<th>{$LANG.clientareastatus}</th>
<th class="responsive-edit-button" style="display: none;"></th>
</tr>
</thead>
<tbody>
{foreach key=num item=service from=$services}
<tr onclick="clickableSafeRedirect(event, 'clientarea.php?action=productdetails&id={$service.id}', false)">
<td><strong>{$service.product}</strong>{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td>
<td class="text-center" data-order="{$service.amountnum}">{$service.amount}<br />{$service.billingcycle}</td>
<td class="text-center"><span class="hidden">{$service.normalisedNextDueDate}</span>{$service.nextduedate}</td>
<td class="text-center"><span class="label status status-{$service.status|strtolower}">{$service.statustext}</span></td>
<td class="responsive-edit-button" style="display: none;">
<a href="clientarea.php?action=productdetails&id={$service.id}" class="btn btn-block btn-info">
{$LANG.manageproduct}
</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
<div class="text-center" id="tableLoading">
<p><i class="fa fa-spinner fa-spin"></i> {$LANG.loading}</p>
</div>
我已尝试替换以下行:
<td><strong>{$service.product}</strong>{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td>
与
<td><strong>{$service.product}</strong>{if $service_custom_fields.4}<br /><a href="http://{$service_custom_fields.4}" target="_blank">{$service_custom_fields.4}</a>{/if}</td>
但不幸的是,它不起作用。
smarty php 代码适用于电子邮件模板,但此处不适用。
我还尝试通过向产品添加域来使用以下行,但它也不显示自定义字段。
<td><strong>{$service.product}</strong>{if $service.domain}<br /><a href="http://{$service_custom_fields.4}" target="_blank">{$service_custom_fields.4}</a>{/if}</td>
我这样做是因为我认为 domainstatus
{elseif $orderby == 'domainstatus'}
如果域为空,则将设置为 false,然后通过添加域,将其设置为 true,并显示自定义字段,但不起作用。
如果有人可以帮助我,我将不胜感激。
问候。
【问题讨论】: