ďťż

Modyfikacja kalendarza w jPortal2

       

Podstrony


telcocafe

http://www.gim1krosno.bo.pl

Mam mały problemik z dostosowaniem wyglądu kalendarza na wyżej wymienionej stronie opartej na jPortal2.

<?php $month = (isset($month)) ? $month : date("n",time()); $monthnames = array("Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec" ,"Lipiec","Sierpien","Wrzesień","PaÄ˝dziernik","Listopad"," Grudzień"); $textmonth = $monthnames[$month - 1]; $year = (isset($year)) ? $year : date("Y",time()); $today = (isset($today))? $today : date("j", time()); $today = ($month == date("n",time())) ? $today : 32; if ( (($month < 8) && ($month % 2 == 1)) || (($month > 7) && ($month % 2 == 0)) )  $days = 31; if ( (($month < 8) && ($month % 2 == 0)) || (($month > 7) && ($month % 2 == 1)) )  $days = 30; if ($month == 2)  $days = (date("L",time())) ? 29 : 28; $dayone = date("w",mktime(1,1,1,$month,1,$year)); $daylast = date("w",mktime(1,1,1,$month,$days,$year)); echo '<Center><img src="scripts/grafika/data.jpg" width="150" border="0"> <table border="0" cellpadding="0" cellspacing="0" width="150" bgcolor="95BDFF"> <tr> <td Background="scripts/grafika/pasek2.jpg" colspan="7" class="calendar_1">'.$textmonth.'</td> </tr> <tr> <td align="center" width="15%" class="calendar_2">Nd</td> <td align="center" width="14%" class="calendar_2">Pn</td> <td align="center" width="14%" class="calendar_2">Wt</td> <td align="center" width="14%" class="calendar_2">Sr</td> <td align="center" width="14%" class="calendar_2">Cz</td> <td align="center" width="14%" class="calendar_2">Pt</td> <td align="center" width="15%" class="calendar_2">So</td> </tr> '; if($dayone != 0)  $span1 = $dayone; if(6 - $daylast != 0)  $span2 = 6 - $daylast; for($i = 1; $i <= $days; $i++):  $dayofweek = date("w",mktime(1,1,1,$month,$i,$year));  $width = "14%";    if($dayofweek == 0 || $dayofweek == 6)    $width = "15%";    if($i == $today):    $fontcolor = $todayfontcolor;    $class = '4';  endif;  if($i != $today):    $fontcolor = $defaultfontcolor;    $class = '3';  endif; if($i == 1 || $dayofweek == 0): echo '<tr>'; if($span1 > 0 && $i == 1) echo '<td colspan="'.$span1.'" class="calendar_3">&nbsp;</td>'; endif; echo '<td width="'.$width.'" class="calendar_'.$class.'">'.$i.'</td>'; if($i == $days): if($span2 > 0) echo '<td colspan="'.$span2.'" class="calendar_3">&nbsp;</td>'; endif; if($dayofweek == 6 || $i == $days): echo '</tr>'; endif; endfor; echo '</table><img src="scripts/grafika/data2.jpg" width="150" border="0"></Center>';   ?>
Oto jego zmodyfikowany kod z folderu modules/calendar.php

Dodałem w nim tło pod tabelkę kalendarza oraz dodałem dwa obrazki odpowiadające za jego rozpoczęcie i zakończenie oraz jeden pod tło napisu miesiąca.

Dlaczego na początku kalendarza pod obrazkiem "data.jpg" powstaje ok. milimetr odstępu ?? co dobrze widać na stronie. Jak to naprawić ?? Na dolnym obrazku (data2) jest dobrze.

EDT: Jak się zmienia długośc CodeBox ?
Użytkownik krzysiek007 edytował ten post 20 wrzesień 2005, 17:59


<?php $month = (isset($month)) ? $month : date("n",time()); $monthnames = array("Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec" ,"Lipiec","Sierpien","Wrzesień","PaÄ˝dziernik","Listopad"," Grudzień"); $textmonth = $monthnames[$month - 1]; $year = (isset($year)) ? $year : date("Y",time()); $today = (isset($today))? $today : date("j", time()); $today = ($month == date("n",time())) ? $today : 32; if ( (($month < 8) && ($month % 2 == 1)) || (($month > 7) && ($month % 2 == 0)) ) $days = 31; if ( (($month < 8) && ($month % 2 == 0)) || (($month > 7) && ($month % 2 == 1)) ) $days = 30; if ($month == 2) $days = (date("L",time())) ? 29 : 28; $dayone = date("w",mktime(1,1,1,$month,1,$year)); $daylast = date("w",mktime(1,1,1,$month,$days,$year)); <table border="0" cellpadding="0" cellspacing="0" width="150" bgcolor="95BDFF"> <tr> <td valign="top" Background="scripts/grafika/data.jpg" width="150" height="10" colspan="7">&nbsp;</td> </tr> <tr> <td Background="scripts/grafika/pasek2.jpg" colspan="7" class="calendar_1">'.$textmonth.'</td> </tr> <tr> <td align="center" width="15%" class="calendar_2">Nd</td> <td align="center" width="14%" class="calendar_2">Pn</td> <td align="center" width="14%" class="calendar_2">Wt</td> <td align="center" width="14%" class="calendar_2">Sr</td> <td align="center" width="14%" class="calendar_2">Cz</td> <td align="center" width="14%" class="calendar_2">Pt</td> <td align="center" width="15%" class="calendar_2">So</td> </tr> '; if($dayone != 0) $span1 = $dayone; if(6 - $daylast != 0) $span2 = 6 - $daylast; for($i = 1; $i <= $days; $i++): $dayofweek = date("w",mktime(1,1,1,$month,$i,$year)); $width = "14%";   if($dayofweek == 0 || $dayofweek == 6)   $width = "15%";   if($i == $today):   $fontcolor = $todayfontcolor;   $class = '4'; endif; if($i != $today):   $fontcolor = $defaultfontcolor;   $class = '3'; endif; if($i == 1 || $dayofweek == 0): echo '<tr>'; if($span1 > 0 && $i == 1) echo '<td colspan="'.$span1.'" class="calendar_3">&nbsp;</td>'; endif; echo '<td width="'.$width.'" class="calendar_'.$class.'">'.$i.'</td>'; if($i == $days): if($span2 > 0) echo '<td colspan="'.$span2.'" class="calendar_3">&nbsp;</td>'; endif; if($dayofweek == 6 || $i == $days): echo '</tr>'; endif; endfor; echo '<tr> <td valign="top" Background="scripts/grafika/data2.jpg" width="150" height="10" colspan="7">&nbsp;</td> </tr> </table>';   ?> Wersja Poprawiona || Tla dodales jako odzielne rysunki i z tad te przerwy. Nalezalo by je dodac do tabeli
Użytkownik m_uli edytował ten post 20 wrzesień 2005, 18:14
Nie działa, nie wyświetla górnego obrazka. Zobacz sam.

Odswiez strone i skopiuj od nowa zrodlo pomylilem sie ale teraz od nowa napisalem sprobuj teraz.



Opcja numer I:

<?php $month = (isset($month)) ? $month : date("n",time()); $monthnames = array("Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec" ,"Lipiec","Sierpien","Wrzesień","PaÄ˝dziernik","Listopad"," Grudzień"); $textmonth = $monthnames[$month - 1]; $year = (isset($year)) ? $year : date("Y",time()); $today = (isset($today))? $today : date("j", time()); $today = ($month == date("n",time())) ? $today : 32; if ( (($month < 8) && ($month % 2 == 1)) || (($month > 7) && ($month % 2 == 0)) ) $days = 31; if ( (($month < 8) && ($month % 2 == 0)) || (($month > 7) && ($month % 2 == 1)) ) $days = 30; if ($month == 2) $days = (date("L",time())) ? 29 : 28; $dayone = date("w",mktime(1,1,1,$month,1,$year)); $daylast = date("w",mktime(1,1,1,$month,$days,$year)); <table border="0" cellpadding="0" cellspacing="0" width="150" bgcolor="95BDFF"> <tr> <td valign="top" Background="scripts/grafika/data.jpg" width="150" height="10" colspan="7">&nbsp;</td> </tr> <tr> <td Background="scripts/grafika/pasek2.jpg" colspan="7" class="calendar_1">'.$textmonth.'</td> </tr> <tr> <td align="center" width="15%" class="calendar_2">Nd</td> <td align="center" width="14%" class="calendar_2">Pn</td> <td align="center" width="14%" class="calendar_2">Wt</td> <td align="center" width="14%" class="calendar_2">Sr</td> <td align="center" width="14%" class="calendar_2">Cz</td> <td align="center" width="14%" class="calendar_2">Pt</td> <td align="center" width="15%" class="calendar_2">So</td> </tr> '; if($dayone != 0) $span1 = $dayone; if(6 - $daylast != 0) $span2 = 6 - $daylast; for($i = 1; $i <= $days; $i++): $dayofweek = date("w",mktime(1,1,1,$month,$i,$year)); $width = "14%"; if($dayofweek == 0 || $dayofweek == 6)  $width = "15%"; if($i == $today):  $fontcolor = $todayfontcolor;  $class = '4'; endif; if($i != $today):  $fontcolor = $defaultfontcolor;  $class = '3'; endif; if($i == 1 || $dayofweek == 0): echo '<tr>'; if($span1 > 0 && $i == 1) echo '<td colspan="'.$span1.'" class="calendar_3">&nbsp;</td>'; endif; echo '<td width="'.$width.'" class="calendar_'.$class.'">'.$i.'</td>'; if($i == $days): if($span2 > 0) echo '<td colspan="'.$span2.'" class="calendar_3">&nbsp;</td>'; endif; if($dayofweek == 6 || $i == $days): echo '</tr>'; endif; endfor; echo '<tr> <td valign="top" Background="scripts/grafika/data2.jpg" width="150" height="10" colspan="7">&nbsp;</td> </tr> </table>';   ?>

Opcja numer II:

<?php $month = (isset($month)) ? $month : date("n",time()); $monthnames = array("Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec" ,"Lipiec","Sierpien","Wrzesień","PaÄ˝dziernik","Listopad"," Grudzień"); $textmonth = $monthnames[$month - 1]; $year = (isset($year)) ? $year : date("Y",time()); $today = (isset($today))? $today : date("j", time()); $today = ($month == date("n",time())) ? $today : 32; if ( (($month < 8) && ($month % 2 == 1)) || (($month > 7) && ($month % 2 == 0)) ) $days = 31; if ( (($month < 8) && ($month % 2 == 0)) || (($month > 7) && ($month % 2 == 1)) ) $days = 30; if ($month == 2) $days = (date("L",time())) ? 29 : 28; $dayone = date("w",mktime(1,1,1,$month,1,$year)); $daylast = date("w",mktime(1,1,1,$month,$days,$year)); <table border="0" cellpadding="0" cellspacing="0" width="150" bgcolor="95BDFF"> <tr> <td Background="scripts/grafika/data.jpg" colspan="7" class="calendar_1">'.$textmonth.'</td> </tr> <tr> <td align="center" width="15%" class="calendar_2">Nd</td> <td align="center" width="14%" class="calendar_2">Pn</td> <td align="center" width="14%" class="calendar_2">Wt</td> <td align="center" width="14%" class="calendar_2">Sr</td> <td align="center" width="14%" class="calendar_2">Cz</td> <td align="center" width="14%" class="calendar_2">Pt</td> <td align="center" width="15%" class="calendar_2">So</td> </tr> '; if($dayone != 0) $span1 = $dayone; if(6 - $daylast != 0) $span2 = 6 - $daylast; for($i = 1; $i <= $days; $i++): $dayofweek = date("w",mktime(1,1,1,$month,$i,$year)); $width = "14%"; if($dayofweek == 0 || $dayofweek == 6)  $width = "15%"; if($i == $today):  $fontcolor = $todayfontcolor;  $class = '4'; endif; if($i != $today):  $fontcolor = $defaultfontcolor;  $class = '3'; endif; if($i == 1 || $dayofweek == 0): echo '<tr>'; if($span1 > 0 && $i == 1) echo '<td colspan="'.$span1.'" class="calendar_3">&nbsp;</td>'; endif; echo '<td width="'.$width.'" class="calendar_'.$class.'">'.$i.'</td>'; if($i == $days): if($span2 > 0) echo '<td colspan="'.$span2.'" class="calendar_3">&nbsp;</td>'; endif; if($dayofweek == 6 || $i == $days): echo '</tr>'; endif; endfor; echo '</table><Center><img src="scripts/grafika/data2.jpg" width="150" border="0"></Center>';   ?>

Ufffff ...

Opcja nr II : totalne zamieszanie.

Opcje nr I : działa , tylko teraz są podwójne ramki :blink: Obecnie na stronie.
http://www.gim1krosno.bo.pl

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • nvm.keep.pl

  • Sitedesign by AltusUmbrae.