christdi Skrevet 28. februar 2005 Skrevet 28. februar 2005 Hei. Jeg lurer på hvordan jeg kan utheve dagens dato med cal funksjonen med f.eks bold tekst ? Se koden nedenfor : <? print "<pre>"; $uptime = passthru ("cal 2005"); print "</pre>"; ?>
anderlin Skrevet 28. februar 2005 Skrevet 28. februar 2005 Hva slags output gir "cal 2005"? Kanskje du kan erstatte deler av en linje etc?
audunr Skrevet 1. mars 2005 Skrevet 1. mars 2005 Hos meg får jeg: 2005 January February March S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S 1 1 2 3 4 5 1 2 3 4 5 2 3 4 5 6 7 8 6 7 8 9 10 11 12 6 7 8 9 10 11 12 9 10 11 12 13 14 15 13 14 15 16 17 18 19 13 14 15 16 17 18 19 16 17 18 19 20 21 22 20 21 22 23 24 25 26 20 21 22 23 24 25 26 23 24 25 26 27 28 29 27 28 27 28 29 30 31 30 31 April May June S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S 1 2 1 2 3 4 5 6 7 1 2 3 4 3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11 10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18 17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25 24 25 26 27 28 29 30 29 30 31 26 27 28 29 30 July August September S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S 1 2 1 2 3 4 5 6 1 2 3 3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10 10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17 17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24 24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30 31 October November December S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S 1 1 2 3 4 5 1 2 3 2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10 9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17 16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24 23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31 30 31 I ren tekst. Vil nok være enklere å lage en funksjon selv. Her er en jeg kokte ihop for en stund siden. Den er nok ikke veldig bra, og jeg måtte forandre en del, men du kan jo se på det: <?php echo buildTime(); function buildTime() { if ($_GET["Month"] and $_GET["Day"] and $_GET["Year"]) { if (checkdate($_GET["Month"], $_GET["Day"], $_GET["Year"])) { $Hour = $_GET["Hour"]; $Minute = $_GET["Minute"]; $Second = $_GET["Second"]; $Month = $_GET["Month"]; $Day = $_GET["Day"]; $Year = $_GET["Year"]; if ($_GET["Go"] == "Down") { if ($Month == 12) { $Month = 01; $Year++; } else { $Month++; } } elseif ($_GET["Go"] == "Up") { if ($Month == 1) { $Month = 12; $Year--; } else { $Month--; } } } } else { $Hour = date("H", time()); $Minute = date("i", time()); $Second = date("s", time()); $Month = date("m", time()); $Day = date("d", time()); $Year = date("Y", time()); } // Build table for month $output = ' <form name="' . $name . '" id="' . $name . '" method="POST" action="' . $_SERVER["PHP_SELF"] . '"> <input type="hidden" name="Action" value="SaveTime"> <input type="hidden" name="Variable" value="' . $_GET["Variable"] . '"> <input type="hidden" name="Show" value="Popup"> <input type="hidden" name="Month" value="' . str_pad($Month, 2, '0', STR_PAD_LEFT) . '"> <input type="hidden" name="Day" value="' . $Day . '"> <input type="hidden" name="Year" value="' . $Year . '"> <table style="width:137px;background: rgb(255,255,255);border: 1px solid rgb(102,102,102);"> <tr class="timenavigationcells"> <td class="timenavigationcells" style="width:45px;border-bottom:1px solid rgb(178,178,178); border-right: 1px solid rgb(196,196,196)"><a href="' . $_SERVER["PHP_SELF"] . '?Action=FindTime&Show=Popup&Go=Up&Variable=' . $_GET["Variable"] . '&Hour=' . $Hour . '&Minute=' . $Minute . '&Second=' . $Second . '&Month=' . $Month . '&Day=' . $Day . '&Year=' . $Year . '">Opp</a></td> <td class="timenavigationcells" style="width:44px;border-bottom:1px solid rgb(178,178,178); border-right: 1px solid rgb(196,196,196)"><a href="' . $_SERVER["PHP_SELF"] . '?Action=FindTime&Show=Popup&Go=Now&Variable=' . $_GET["Variable"] . '">Nå</a></td> <td class="timenavigationcells" style="width:45px;border-bottom:1px solid rgb(178,178,178)"><a href="' . $_SERVER["PHP_SELF"] . '?Action=FindTime&Show=Popup&Go=Down&Variable=' . $_GET["Variable"] . '&Hour=' . $Hour . '&Minute=' . $Minute . '&Second=' . $Second . '&Month=' . $Month . '&Day=' . $Day . '&Year=' . $Year . '">Ned</a></td> <tr class="timetitlecells" style="font-size: 11px"> <td colspan="3" class="timetitlecells"><p style="text-align:center">' . strtolower(date("F", mktime($Hour, $Minute, $Second, $Month, $Day, $Year))) . ' ' . date("Y", mktime($Hour, $Minute, $Second, $Month, $Day, $Year)) . '</p></td> </tr> <tr> <td colspan="3"> <table> <tr class="timetitlecells"> <td class="timetitlecells"> </td> <td class="timetitlecells">M</td> <td class="timetitlecells">T</td> <td class="timetitlecells">O</td> <td class="timetitlecells">T</td> <td class="timetitlecells">F</td> <td class="timetitlecells">L</td> <td class="timetitlecells">S</td> </tr>'; for ($d = 1; $d <= date("t", mktime($Hour, $Minute, $Second, $Month, $Day, $Year)); $d++) { // If this is the first day of the month, or a monday, start a new row if ($d == 1 or date("D", mktime($Hour, $Minute, $Second, $Month, $d, $Year)) == "Mon") { $output .= ' <tr class="timenormalcells"> <td class="timenormalcells">' . date("W", mktime($Hour, $Minute, $Second, $Month, $d, $Year)) . '</td>'; } // If this is the first day of the month, output additional cells if the first day isn't a monday if ($d == 1) { $Days = array("Mon","Tue","Wed","Thu","Fri","Sat","Sun"); $i = 0; while ($Days[$i] != date("D", mktime($Hour, $Minute, $Second, $Month, $d, $Year))) { $i++; $output .= ' <td class="timenormalcells"> </td>'; } } if ($d == $Day) { $Style = "font-weight:bold"; } else { unset($Style); } $output .= ' <td style="' . $Style . '"><a href="' . $_SERVER["PHP_SELF"] . '?Action=FindTime&Show=Popup&Variable=' . $_GET["Variable"] . '&Hour=' . $Hour . '&Minute=' . $Minute . '&Second=' . $Second . '&Month=' . $Month . '&Day=' . str_pad($d, 2, '0', STR_PAD_LEFT) . '&Year=' . $Year . '">' . $d . '</a></td>'; if (date("D", mktime($Hour, $Minute, $Second, $Month, $d, $Year)) == "Sun") { $output .= ' </tr>'; } } $output .= ' </table> </td> <tr> <td colspan="3"><p style="text-align:center"><input type="text" maxlength="2" style="font-size:10px;width:20px" name="Hour" value="' . $Hour . '">:<input type="text" maxlength="2" style="font-size:10px;width:20px" name="Minute" value="' . $Minute . '">:<input type="text" maxlength="2" style="font-size:10px;width:20px" name="Second" value="' . $Second . '"></p></td> </tr> </table> <input type="Submit" value="Lagre" class="button"> </form>'; return $output; } ?> MVH Audun
Anbefalte innlegg
Opprett en konto eller logg inn for å kommentere
Du må være et medlem for å kunne skrive en kommentar
Opprett konto
Det er enkelt å melde seg inn for å starte en ny konto!
Start en kontoLogg inn
Har du allerede en konto? Logg inn her.
Logg inn nå