Seite 3 von 4

Verfasst: 03.03.2003 18:06
von Jason

Code: Alles auswählen

 // For the Birthday Mod
            $query = "select user_id, username, user_birthday
      FROM ".USERS_TABLE." u
      WHERE month(date_add(\"1970-01-01\", interval(user_birthday) day)) = '".$monthView['month']."'
      AND dayofmonth(date_add(\"1970-01-01\", interval(user_birthday) day)) = '$day'
      AND user_birthday < '999999';";

            if (!$result = $db->sql_query($query)) {
                message_die(GENERAL_ERROR, 'Error querying dates for calendar.');
            }

            while ($topic = $db->sql_fetchrow($result)) {
                $topic_text = $lang['Birthday'];
                $username = $topic['username'];
                $birthday = $monthView['year'] - date('Y', $topic['user_birthday']);
                $user_id = $topic['user_id'];
                $profillink = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");

                $template->assign_block_vars('date_row.date_cell.switch_date_cells.date_event', array(
                     'U_EVENT' => "$first_date<span class='gensmall'><font color='#000000'>&#149;</font></span>&nbsp;<a href=\"$profillink\" align='left' onMouseOver=\"createTitle(this, '<b>" . $lang['Birthday'] . ":</b> $username<br>" . $lang['Calendar_birthday_greeting_first'] . "&nbsp;<b>$birthday</b>&nbsp;" . $lang['Calendar_birthday_greeting_sec'] . "', event.pageX, event.pageY);\" onMouseOut=\"destroyTitle();\" class=\"gensmall\">$topic_text: <b>$username</b></a>\n\t<div style='height: 1px;'><IMG SRC='dot.gif' WIDTH='1' HEIGHT='1' BORDER=0></div>")
                );
                $numEvents++;
            }
Grüße Jason

Verfasst: 03.03.2003 18:19
von saerdnaer
füge nach

Code: Alles auswählen

$birthday = $monthView['year'] - date('Y', $topic['user_birthday']);
folgendes ein:

Code: Alles auswählen

echo 'u' . $topic['user_birthday'];
ah

Verfasst: 03.03.2003 19:19
von Jason
Dann steht dort:
u3714u4834
Grüße Jason

Verfasst: 04.03.2003 01:55
von Henne
Mal ne Frage:
Wo hast du diese Version her?
Ich hab folgende Version:

Code: Alles auswählen

                    // For the Birthday Mod 
            $query = "select username, DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(date_add(\"1970-01-01\", interval(user_birthday) day))), '%Y')+1 as birthday 
                      from ".USERS_TABLE." u 
                  WHERE month(date_add(\"1970-01-01\", interval(user_birthday) day)) = '".$monthView['month']."' 
                  AND dayofmonth(date_add(\"1970-01-01\", interval(user_birthday) day)) = '$day' 
                  AND user_birthday < '999999';"; 

            if (!$result = $db->sql_query($query)) { 
                message_die(GENERAL_ERROR, 'Error querying dates for calendar.'); 
            } 

            while ($topic = $db->sql_fetchrow($result)) { 
                $topic_text = "Geburtstag"; 
                $username = $topic['username']; 
                $birthday = $topic['birthday']; 
             if ($today['month']>$monthView['month'] || ($today['month']==$monthView['month'] && $today['day']>=$day)) 
                 $birthday = $birthday - ($today['year']-$monthView['year']+1);          
            elseif ($today['month']<$monthView['month'] || ($today['month']==$monthView['month'] && $today['day']<$day)) 
                 $birthday = $birthday - ($today['year']-$monthView['year']); 

                $template->assign_block_vars('date_row.date_cell.switch_date_cells.date_event', array( 
                     'U_EVENT' => "$first_date<a href=\"#\" onMouseOver=\"createTitle(this, '<b>Geburtstag:</b> $username<br>Herzlichen Glückwunsch zum <b>$birthday</b> Geburtstag.', event.pageX, event.pageY);\" onMouseOut=\"destroyTitle();\" class=\"gensmall\">$topic_text</a>") 
                ); 
            }
Also der Part

Code: Alles auswählen

  $birthday = $topic['birthday']; 
             if ($today['month']>$monthView['month'] || ($today['month']==$monthView['month'] && $today['day']>=$day)) 
                 $birthday = $birthday - ($today['year']-$monthView['year']+1);          
            elseif ($today['month']<$monthView['month'] || ($today['month']==$monthView['month'] && $today['day']<$day)) 
                 $birthday = $birthday - ($today['year']-$monthView['year']);
sieht bei mir ja total anders aus.
Kann es daran irgendwie liegen?

Verfasst: 06.03.2003 17:19
von Jason
Hi,
also ich habe jetzt mal meine Version komplett mit der von henne ersetzt da funzt es auch, vor dem tag des Geburtstags und nach dem Tag des Geburtstags wird 23 angezeigt aber direkt am Tag des Geburtstags wird 22 angezeigt also 1 Jahr abgezogen?

Hat jemand ne idee woran das liegen könnte?

Grüße Jason

Verfasst: 06.03.2003 18:58
von Henne
Jason hat geschrieben:Hi,
also ich habe jetzt mal meine Version komplett mit der von henne ersetzt da funzt es auch, vor dem tag des Geburtstags und nach dem Tag des Geburtstags wird 23 angezeigt aber direkt am Tag des Geburtstags wird 22 angezeigt also 1 Jahr abgezogen?
Hab grade festgestellt, dass bei mir das gleiche Problem besteht.
Werd da gleich mal drüberschauen...
Dann ist der Abend ja gerettet... :wink:

Verfasst: 06.03.2003 19:10
von Henne
So, da ich nicht so der PHP Profi bin, hab ich mal ein wenig gemogelt.
Wenn wer was besseres weiß, dann teilt mir das bitte mit.
Aber wenigstens funzt es jetzt bei mir.
Hier der Teil:
$birthday = $topic['birthday'];
if ($today['month']>$monthView['month'] || ($today['month']==$monthView['month'] && $today['day']>=$day xor $today['day']==$day))
$birthday = $birthday - ($today['year']-$monthView['year']+1);
elseif ($today['month']<$monthView['month'] || ($today['month']==$monthView['month'] && $today['day']<$day))
$birthday = $birthday - ($today['year']-$monthView['year']);
Das rote ist der neue Teil...

Verfasst: 06.03.2003 19:57
von Jason
Jo jetzt steht zwar wieder 23 am Tag des Geburtstags aber wenn ich ein Jahr weiter gehe steht dort auch noch 23 und net wies sein sollte 24 :roll:

Grüße Jason

Verfasst: 06.03.2003 20:27
von Henne
Ich glaube man muss die ganze Berechnung umschreiben.
Der unterscheidet ja nur, ob er 1 addieren muss oder so lassen.

Verfasst: 06.03.2003 20:56
von Henne
Ok, ich glaube jetzt habe ich es. Oben das kannste alles vergessen.
Es muss einfach heißen:

Code: Alles auswählen

$birthday = $topic['birthday'];
$birthday = $birthday + ($monthView['year']-$today['year']);
Ich glaube das funktioniert dann...