2015-10-06 52 views
0

這是我能得到的所有頂級域名(域名)的價格列表:WHMCS Smarty的:自定義域名價格表

{foreach from=$tldpricelist item=tldprice} TLD: {$tldprice.tld} - Price: {$tldprice.register} {/foreach}

Hoever我想只爲我在陣列佔有一定的頂級域名顯示價格:

{$pricelist=["co.uk","me.uk","org.uk","uk","london","com","info","net","biz","org","name","eu"]}

我很新的SMARTY,我相信應該有呼籲$tldpricelist只對某些TLD的一些簡單方法。

回答

0

嘗試in_array fucntion。我在你的代碼中添加了一個支票。如果tld將在您的$ pricelist數組中,那麼它將顯示TLD,否則價格不會。

{$pricelist=["co.uk","me.uk","org.uk","uk","london","com","info","net","biz","org","name","eu"]} 

{foreach from=$tldpricelist item=tldprice} 

{if in_array($tldprice.tld,$pricelist} 
    TLD: {$tldprice.tld} - Price: {$tldprice.register} 
{/if} 

{/foreach}