Autor | Zpráva | ||
---|---|---|---|
protom1 Profil |
#1 · Zasláno: 17. 4. 2016, 11:46:21
Lidi jsem na dně, prosím o radu.
Jak oddělat tu hloupou mezeru, která vznika s <td>, místo kterýho já zapíšu ten z databáze .. Bude to asi nějaká podmínka, ale já už jsem z toho tak vykoukanej, že už nemůžu myslet .. $monat=date('n'); $jahr=date('Y'); $heute=date('d'); $monate=array('Leden','Únor','Březen','Duben','Květen','Červen','Červenec','Srpen','Září','Říjen','Listopad','Prosinec'); echo '<table border=0>'; echo '<th colspan=4 align=center style="color:white;">'.$jahr.'</th>'; for ($reihe=1; $reihe<=3; $reihe++) { echo '<tr>'; for ($spalte=1; $spalte<=4; $spalte++) { $this_month=($reihe-1)*4+$spalte; $erster=date('w',mktime(0,0,0,$this_month,1,$jahr)); $insgesamt=date('t',mktime(0,0,0,$this_month,1,$jahr)); if ($erster==0) $erster=7; echo '<td width="25%" valign=top>'; echo '<table border=0 align=center>'; echo '<th colspan=7 align=center style="color:#c0c0cc;">'.$monate[$this_month-1].'</th>'; echo '<tr><td style="color:white"><b>Po</b></td><td style="color:white"><b>Ut</b></td>'; echo '<td style="white"><b>St</b></td><td style="color:white"><b>Čt</b></td>'; echo '<td style="color:white"><b>Pá</b></td><td style="color:#eb381b"><b>So</b></td>'; echo '<td style="color:#f9ea3e"><b>Ne</b></td></tr>'; echo '<tr><br>'; $i=1; while ($i<$erster) { echo '<td> </td>'; $i++; } $i=1; while ($i<=$insgesamt) { $rest=($i+$erster-1)%7; if (($i==$heute) && ($this_month==$monat)) { echo '<td style="background:#962929;" align=center>'; } else { echo '<td style="color:white;" align=center>'; } foreach ($udalosti as $key => $value) { $den = $value['den']; $mesic = $value['mesic']; $akce = $value['akce']; $nadpis = $value['nadpis']; $id = $value['id']; if (($i==$den) && ($this_month==$mesic)) { if($akce == 1) { echo '<td style="background:#3f63db;" align=center title="' . $nadpis . '"><a href="koncerty.php?view.php?id=' . $id . '">'; } if($akce == 2) { echo '<td style="background:#27be24;" align=center title="' . $nadpis . '">'; } if($akce == 3) { echo '<td style="background:#e2e41a;" align=center title="' . $nadpis . '">'; } }} if (($i==$heute) && ($this_month==$monat)) { echo '<span style="color:#ffffff;">'.$i.'</span>'; } else if(($i==$den) && ($this_month==$mesic)){ if($akce == 3) { echo '<span style="color:#000000 !important">'.$i.'</span></a>'; }else { echo '<span style="color:#ffffff !important">'.$i.'</span></a>'; } } else if ($rest==6) { echo '<span style="color:#ffffff !important">'.$i.'</span></a>'; } else if ($rest==0) { echo '<span style="color:#f9ea3e">'.$i.'</span>'; } else { echo $i; } echo "</td>\n"; if ($rest==0) echo "</tr>\n<tr>\n"; $i++; } echo '</tr>'; echo '</table>'; echo '</td>'; } echo '</tr>'; } echo '</table>'; |
||
protom1 Profil |
#2 · Zasláno: 17. 4. 2016, 17:44:23
Vyřešeno :
$monat=date('n'); $jahr=date('Y'); $heute=date('d'); $monate=array('Leden','Únor','Březen','Duben','Květen','Červen','Červenec','Srpen','Září','Říjen','Listopad','Prosinec'); echo '<table border=0>'; echo '<th colspan=4 align=center style="color:white;">'.$jahr.'</th>'; for ($reihe=1; $reihe<=3; $reihe++) { echo '<tr>'; for ($spalte=1; $spalte<=4; $spalte++) { $this_month=($reihe-1)*4+$spalte; $erster=date('w',mktime(0,0,0,$this_month,1,$jahr)); $insgesamt=date('t',mktime(0,0,0,$this_month,1,$jahr)); if ($erster==0) $erster=7; echo '<td width="25%" valign=top>'; echo '<table border=0 align=center>'; echo '<th colspan=7 align=center style="color:#c0c0cc;">'.$monate[$this_month-1].'</th>'; echo '<tr><td style="color:white"><b>Po</b></td><td style="color:white"><b>Ut</b></td>'; echo '<td style="white"><b>St</b></td><td style="color:white"><b>Čt</b></td>'; echo '<td style="color:white"><b>Pá</b></td><td style="color:#eb381b"><b>So</b></td>'; echo '<td style="color:#f9ea3e"><b>Ne</b></td></tr>'; echo '<tr><br>'; $i=1; while ($i<$erster) { echo '<td> </td>'; $i++; } $i=1; while ($i<=$insgesamt) { $rest=($i+$erster-1)%7; $a = 0; if (($i==$heute) && ($this_month==$monat)) { echo '<td style="background:#962929;" align=center>'; } else { foreach ($udalosti as $key => $value) { $den = $value['den']; $mesic = $value['mesic']; $akce = $value['akce']; $nadpis = $value['nadpis']; $id = $value['id']; if (($i==$den) && ($this_month==$mesic)) { $a = 1; } } if($a == 0) { echo '<td style="color:white;" align=center value="aa">'; } } foreach ($udalosti as $key => $value) { $den = $value['den']; $mesic = $value['mesic']; $akce = $value['akce']; $nadpis = $value['nadpis']; $id = $value['id']; if (($i==$den) && ($this_month==$mesic)) { $a = 1; if($akce == 1) { echo '<td style="background:#3f63db;" align=center title="' . $nadpis . '"><a href="koncerty.php?view.php?id=' . $id . '">'; } if($akce == 2) { echo '<td style="background:#27be24;" align=center title="' . $nadpis . '">'; } if($akce == 3) { echo '<td style="background:#e2e41a;" align=center title="' . $nadpis . '">'; } }} if (($i==$heute) && ($this_month==$monat)) { echo '<span style="color:#ffffff;">'.$i.'</span>'; }else if(($a==1)){ foreach ($udalosti as $key => $value) { $den = $value['den']; $mesic = $value['mesic']; $akce = $value['akce']; $nadpis = $value['nadpis']; $id = $value['id']; if (($i==$den) && ($this_month==$mesic)) { if($akce == 3) { echo '<span style="color:#000000 !important">'.$i.'</span></a>'; }else { echo '<span style="color:#ffffff !important">'.$i.'</span></a>'; } } } } else if ($rest==6) { echo '<span style="color:#ffffff !important">'.$i.'</span></a>'; } else if ($rest==0) { echo '<span style="color:#f9ea3e">'.$i.'</span>'; } else { echo $i; } echo "</td>\n"; if ($rest==0) echo "</tr>\n<tr>\n"; $i++; } echo '</tr>'; echo '</table>'; echo '</td>'; } echo '</tr>'; } echo '</table>'; |
||
Časová prodleva: 9 let
|
0