Jump to content
GIGN Forum

Kalendars


DipSy
 Share

Recommended Posts

ak tu jeezus :D pilns neta, kaa var neatrast taadas lietas googlee - php calendar :lol:

lab nekaa labaak neteiksu un kaarteejo reizi kaadam palidizeeshu :D

<?php
        $month = 9; // noraadam meenesi
        $year = 2008; // noraadam gadu
        $start = mktime(0,0,0,$month,1,$year);
        $days = date('t', $start);
        $first_day = date('w',$start);
        $last_day = date('w',mktime(0,0,0,$month,$days,$year));
        if ($first_day==0) $first_day=7;
        if ($last_day==0) $last_day=7;
        $from = $first_day-2;
        $to = $days+7-$last_day;
    echo '<table border="0" style="border:0px dashed black;">'."\n";
    echo "<td>P</td><td>O</td><td>T</td><td>C</td><td>P</td><td>S</td><td>Sv</td>";
        for($i=-$from; $i<=$to; $i++) {
        if (($i+$from)%7==0) echo "<tr>\n";
        if ($i<=0 || $i>$days) { 
        echo "<td> </td>\n";
        } else {
        $wd = ($i+$from)%7;
        echo "<td ".($wd>=5?' style="color:red"':'').">$i</td>\n";
        }
        if (($i+$from+1)%7==0) echo "</tr>\n";
        }
        echo '</table>';
?>

ja nevelelies visulaik editeet failu un labot gadu, menesi tad izlabo

$month = 9; // noraadam meenesi
        $year = 2008; // noraadam gadu

->UZ->

$month = date("m");
        $year = date("Y");

Edited by RaaapuLis
Link to comment
Share on other sites

Man katukas nogaja greizi

uzmet šito!

'."\n"; echo "POTCPSSv"; for($i=-$from; $i<=$to; $i++) { if (($i+$from)%7==0) echo "\n"; if ($i<=0 || $i>$days) { echo " \n"; } else { $wd = ($i+$from)%7; echo "=5?' style="color:red"':'').">$i\n"; } if (($i+$from+1)%7==0) echo "\n"; } echo ''; ?>

Edited by DipSy
Link to comment
Share on other sites

Kurš ir šito taisījis, lol? :D

echo '<table border="0" style="border:0px dashed black;">'."\n";

ja iekš style ir norādīts border:0px; tad nav vajadzīgs ne border="0", jo tas ir deprecated pirmkārt, un otrkārt nav vajadzīgs norādīt bordera tipu un krāsu "dashed black", jo border tak ir 0px.

treškārt gļuks ir pēdiņās, kapēc tiek vienotas kopā dažādas pēdiņas ?

'." wtf ?

nav sakars ar <?php tagu, jo kods apraujas vidū un kur Tu pirms tam redzi <? tagu ?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...