0
正在爲我的網站製作網站地圖,它是多語言的。Smarty/PHP:foreach循環與三個陣列
我當前的網站地圖的代碼看起來像
{foreach from=$data.listings_en item=i}
<url>
<loc>{$i}</loc>
</url>
{/foreach}
它只是對英語網址,這是確定的,現在我想添加一些其他的語言,它但我不我不能夠把它怎麼過三陣列以上述foreach循環
三個陣列我有在$ data.listings_en
$data.listings_en
$data.listings_cn
$data.listings_ru
值
$listings_en[] = 'my link 1';
$data['listings_en'] = $listings_en;
我想類似的東西
{foreach from=$data.listings_en item=i} // loop over three arrays all arrays have same size
<url>
<loc>{$i}</loc> // print url of listening_en
<loc>{$i}</loc> // print url of listening_cn
<loc>{$i}</loc> // print url of listening_ru
</url>
{/foreach}
你真的需要一個模板上的所有語言是什麼?或每個模板一種語言? – ksimka
你是如何成爲'$ data.listings_en'中的字符串值的。數組中的簡單字符串或字符串? –
@Sougata問題已更新。 $ data.listings_en中的值是數組中的字符串 – user889030