【发布时间】:2014-10-15 05:22:44
【问题描述】:
使用表达式引擎我有几个这样的循环:
{exp:channel:entries ........} <--- CMS Loop starts --->
$data ="{event_day}.{event_month}.{event_year }"; // will output 19.21.2013
$titlu = htmlentities("{title}"); // string
$link = "{adresa_externa}"; // website
$arrContent3[strtotime($data)] = substr($data, 0, 5)." - ". "<a href='$link'> " . $titlu ." </a>";
{/exp:channel:entries} <--- cms loops ends --- >
在数组之后我们有以下代码:
<---- outputing in chronological order based on day year month --->
<?php
ksort($arrContent3) ;
echo html_entity_decode(implode("</li><li>", $arrContent));
?>
问题在于,如果存在 2 个日期完全相同的事物。列表中只会显示一个。
我不知道为什么:(
【问题讨论】:
-
您正在使用
strtotime($data)作为数组键。数组不能有重复的键。 -
你对这个键有什么建议?我希望这些事件在同一天进入数组。 :(
-
我不知道您使用密钥的目的,所以我无法预测更改它的后果。但是您知道问题出在哪里,因此您应该能够自行决定。
-
我必须汇集来自不同来源的多个事件数组,然后根据日期和月份输出所有事件
标签: php arrays sorting duplicates date-sorting