Smarty / PHP: 三个数组的foreach循环
Smarty / PHP: foreach loop with three array
正在为我的多语言网站制作站点地图。
我当前的站点地图代码看起来像
{foreach from=$data.listings_en item=i}
<url>
<loc>{$i}</loc>
</url>
{/foreach}
它只适用于英文网址,现在可以了,我正在尝试用它添加一些其他语言,但我做不到,因为我不知道如何将三个数组传递到上面的 foreach 循环
我有三个数组
$data.listings_en
$data.listings_cn
$data.listings_ru
$data.listings_en
中的值
$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}
{foreach from=$data item=i} <li>{$i}</li>{/foreach}
正在为我的多语言网站制作站点地图。
我当前的站点地图代码看起来像
{foreach from=$data.listings_en item=i}
<url>
<loc>{$i}</loc>
</url>
{/foreach}
它只适用于英文网址,现在可以了,我正在尝试用它添加一些其他语言,但我做不到,因为我不知道如何将三个数组传递到上面的 foreach 循环
我有三个数组
$data.listings_en
$data.listings_cn
$data.listings_ru
$data.listings_en
中的值$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}
{foreach from=$data item=i} <li>{$i}</li>{/foreach}