[英]Smarty / PHP: foreach loop with three array
am making sitemap for my website which is multi language. 我正在为我的网站制作多语言的站点地图。
my current sitemap code looks like 我当前的站点地图代码如下所示
{foreach from=$data.listings_en item=i}
<url>
<loc>{$i}</loc>
</url>
{/foreach}
it was only for english urls which was ok now am trying to add few other language with it but am not able to it as i do not how to pass three arrays to above foreach loop 它仅适用于英文网址,现在可以尝试添加其他几种语言,但无法这样做,因为我不将三个数组传递给上述foreach循环
three arrays i have 我有三个数组
$data.listings_en
$data.listings_cn
$data.listings_ru
values in $data.listings_en $ data.listings_en中的值
$listings_en[] = 'my link 1';
$data['listings_en'] = $listings_en;
what i want something like that 我想要这样的东西
{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}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.