2011-07-24 141 views
0
<?php 
     while($show = $grabAlbums->fetch()){ 
      $date_headers_array[date('m', $show["date"])][date('d', $show["date"])][] = $show; 
     } 

foreach ($date_headers_array as $month => $v1) { 
    foreach ($v1 as $day => $v2) { 
    ?> 
<h3 class="EventlistHeader" style="margin-bottom: 4px;"> 
    <?php 
    echo htmlentities(ucfirst(strftime("%A", $v2[0]['date'])))." "; 
    echo $day.". ".strftime('%B', $v2[0]['date']); 
    ?> 
</h3> 
<?php 
foreach ($v2 as $album) { 
echo $album["content"] "<br>"; 
} 
?> 

这是使一个H3标题为存在于$秀[“日”]PHP:显示每月

什么,我找做的是显示每月头而不是每一天entrys。

它显示了现在这个样子:

**Tuesday 12 july:** 
content 
**Wednesday 13 july:** 
content 
**Thursday 28 july:** 
content 

我想让它显示是这样的:

**July** 
12th, content 
13th, content 
28th, content 

**是H3头

我怎么能做到这一点?

回答

1
foreach ($date_headers_array as $month => $v1) { 
    echo "<h3>$month</h3>"; 
    foreach ($v1 as $day => $v2) { 
     echo "$day, "; 
    ... 

我会离开的改变与1-12一月至十二月,并添加ST,次,次给你