以下のコードでは...タグは「$mname1」で、現在は4月、5月、6月の3つの値のみを取ります。
if ( $profile_stats['month'] < $old_month && $profile_stats['year'] == $old_year
|| $profile_stats['month'] == date('m') && $profile_stats['year'] == date('Y') ) {
?>
<?php
}
else {
if ( $profile_stats['month'] == 1 ) {
$mname1 = 'January';
}
elseif ( $profile_stats['month'] == 2 ) {
$mname1 = 'Feburary';
}
elseif ( $profile_stats['month'] == 3 ) {
$mname1 = 'March';
}
elseif ( $profile_stats['month'] == 4 ) {
$mname1 = 'April';
}
elseif ( $profile_stats['month'] == 5 ) {
$mname1 = 'May';
}
elseif ( $profile_stats['month'] == 6 ) {
$mname1 = 'June';
}
elseif ( $profile_stats['month'] == 7 ) {
$mname1 = 'July';
}
elseif ( $profile_stats['month'] == 8 ) {
$mname1 = 'August';
}
elseif ( $profile_stats['month'] == 9 ) {
$mname1 = 'September';
}
elseif ( $profile_stats['month'] == 10 ) {
$mname1 = 'October';
}
elseif ( $profile_stats['month'] == 11 ) {
$mname1 = 'November';
}
elseif ( $profile_stats['month'] == 12 ) {
$mname1 = 'December';
}
if ( $profile_stats['month'] == date('m') && $profile_stats['year'] == date('Y') ) {
$mname1 = "<i>Current Month</i> - $mname1";
}
if ( $profile_stats['month'] == 04 && $profile_stats['year'] == 2012 ) {
$newstats_alert = "<p><b style='color: red;'><i>April 2012 stats are only partial due to implementation of this feature mid month.</i></b></p>";
}
else {
$newstats_alert = NULL;
}
?>
ここ、
date("m") shows value 10 10 10
date("Y") shows 12 12 12
$profile_stats['month'] shows 05 04 03
$profile_stats['year'] shows 2012 2012 2012
$old_month shows 10 10 10
$old_year shows 2011 2011 2011
私はこれをすべて使用してテーブルを印刷しています..以下はコードです:
<tr>
<td colspan='4' style='border: 2px solid black;'><div align="center"><b><u><?=$mname1?> <?=$profile_stats['year']?></u></b><?=$newstats_alert?></div></td>
</tr>
<tr>
<td>Profile Views</td>
<td>Course Views</td>
<td>General Enquiries</td>
<td>Course Enquiries</td>
</tr>
<tr>
<td><?=($profile_stats['profile_views'] + 0)?></td>
<td><?=($course_views[$profile_stats['year']."-".$profile_stats['month']] + 0)?></td>
<td><?=($profile_stats['general_enquiries'] + 0)?></td>
<td><?=($course_enquiries[$profile_stats['year']."-".$profile_stats['month']] + 0)?></td>
</tr>
<tr>
<td colspan='2'>Total Views: <?=($profile_stats['profile_views'] + $course_views[$profile_stats['year']."-".$profile_stats['month']] + 0)?></td>
<td colspan='2'>Total Enquiries: <?=($profile_stats['general_enquiries'] + $course_enquiries[$profile_stats['year']."-".$profile_stats['month']] + 0)?></td>
</tr>
date("m")-1
このコードは、4月、5月、6月のテーブルのみを生成しています...このコードを編集して、月まで、つまり9月までテーブルを印刷する方法はありますか。
私を助けてください