Guten Morgen ...........
danke ..... hab das mal direkt eingebaut. Kleine Frage dazu vielleicht kennt sich ja jemand ein wenig besser aus damit als ich:
Der Code für die index.php lautet
Code: Alles auswählen
// Generate anniversary list
$anniversary_list = $cache->get('anniversary_list');
if ($anniversary_list === false)
{
$anniversary_list = '';
$current_date = date('m-d');
$current_year = date('Y');
$leap_year = date('L');
$sql = 'SELECT user_id, username, user_colour, user_regdate
FROM ' . USERS_TABLE . "
WHERE user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
// We are compensating for leap year here. If the year is not a leap year, the current date is Feb 28, and they joined Feb 29 we will list their names.
if (date('m-d', $row['user_regdate']) == $current_date || (!$leap_year && $current_date == '02-28' && date('m-d', $row['user_regdate']) == '02-29'))
{
if (($current_year - date('Y', $row['user_regdate'])) > 0)
{
$anniversary_list .= (($anniversary_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
$anniversary_list .= ' (' . ($current_year - date('Y', $row['user_regdate'])) . ')';
}
}
}
$db->sql_freeresult($result);
//Figure out what tomorrow's beginning time is based on the board timezone settings and have the cache expire then.
$till_tomorrow = gmmktime(0, 0, 0) + 86400 - ($config['board_timezone'] * 3600) - ($config['board_dst'] * 3600) - time();
$cache->put('anniversary_list', $anniversary_list, $till_tomorrow);
}
$template->assign_var('ANNIVERSARY_LIST', $anniversary_list);
Hier wird ja definiert ab wann die Liste angezeigt wird. So wie ich das jetzt in dem Abschnitt mit tomorrow sehe wird die Liste einen Tag voher angezeigt. Kann man das auch so umschreiben das immer der nächste Jubilar oder die nächsten Jubilare gesehen werden? Alternativ auch die Liste 30 Tage vorher anzeigen im Prinzip wie bei den Geburtstagen.
Edit: ok habs ein wenig anders gelöst ... so siehts jetzt aus
[ externes Bild ]
Gruß Huch