Aleksandrs Posted February 22, 2005 Report Share Posted February 22, 2005 Uztaisiju kalendāra kodu, neizskatās diezko optimizēts: http://paste.php.lv/1683/ Ir ietiekumi kā uzlabot? Link to comment Share on other sites More sharing options...
hmnc Posted February 22, 2005 Report Share Posted February 22, 2005 Uztaisiju kalendāra kodu, neizskatās diezko optimizēts: http://paste.php.lv/1683/ Ir ietiekumi kā uzlabot? 14081[/snapback] dikti līdzīgs manis veidotajam (pirms 2 vai 3 gadiem). nē nē nesaku, ka nozagi - nav jau no kurienes :D kompakts. tas ir labi. slinkums tuvāk pētīt :) Link to comment Share on other sites More sharing options...
Kaklz Posted February 23, 2005 Report Share Posted February 23, 2005 Padomā par: #1 if($i==0+$sakas || $i==8+$sakas || $i==15+$sakas || $i==22+$sakas || $i==29+$sakas){ #2 if($i==7+$sakas || $i==14+$sakas || $i==21+$sakas || $i==28+$sakas || $i==35+$sakas){ un #3 for($i=1+$sakas; $i<=$cik_dienas+$sakas*2; $i++){ Link to comment Share on other sites More sharing options...
v3rb0 Posted February 23, 2005 Report Share Posted February 23, 2005 Ja atstāsi kalendāru šādā tabulā, tad tabulai colspanus pieliec, kaut vai tāpēc, lai radinātos pie pedantisma un w3c dusmīgais validātoris neblaustās. Link to comment Share on other sites More sharing options...
bubu Posted February 23, 2005 Report Share Posted February 23, 2005 (edited) Manuprāt, tev for cikls dīvains (pie tam - tavs kods pēdējai rindiņai nesaliek pareizu sakaitu (7) rūtiņu, t.b. <td> tegu). Man tavs php kods pārrakstījās šāds: <?php $t = time(); //mktime(0,0,0,7,2,2005); $cik_dienas = date('t', $t); $shodiena = date('d', $t); $gads = date('Y', $t); $menesis = date('m', $t); $first = getdate(mktime(0,0,0,$menesis,1,$gads)); $sakas = $first['wday']; $sakas = ($sakas==0 ? 7 : $sakas); $last = getdate(mktime(0,0,0,$menesis,$cik_dienas,$gads)); $beidzas = $last['wday']; $beidzas = $cik_dienas + (7-($beidzas==0 ? 7 : $beidzas)); for($day=-$sakas+2, $start=0; $day<=$beidzas; $day++, $start++) { if ($start%7==0) { echo "<tr>\n"; } if ($day>0 && $day<=$cik_dienas) { $style = ($day==$shodiena ? 'text-decoration:underline;' : ''); $style .= ($start%7>4 ? 'color:#FF0000;' : ''); echo '<td'.($style=='' ? '' : ' style="'.$style.'"').'>'.$day.'</td>'; } else { echo' <td></td>'; } if ($start%7==6) { echo "</tr>\n"; } } ?> Edited February 23, 2005 by bubu Link to comment Share on other sites More sharing options...
lazda144 Posted January 2, 2008 Report Share Posted January 2, 2008 a var uztaisiit lai raada meenesi?? Link to comment Share on other sites More sharing options...
bubu Posted January 2, 2008 Report Share Posted January 2, 2008 Jā, visu var uztaisīt lai rāda. Link to comment Share on other sites More sharing options...
lazda144 Posted January 2, 2008 Report Share Posted January 2, 2008 bet kaa?? Link to comment Share on other sites More sharing options...
Val Posted January 2, 2008 Report Share Posted January 2, 2008 tāds nebija jautājums Link to comment Share on other sites More sharing options...
lazda144 Posted January 3, 2008 Report Share Posted January 3, 2008 tas bija ieteikums ko optimizeet! Link to comment Share on other sites More sharing options...
Aleksejs Posted January 3, 2008 Report Share Posted January 3, 2008 Nā, tas bija jautājums, nevis ieteikums! ;) Link to comment Share on other sites More sharing options...
lazda144 Posted January 3, 2008 Report Share Posted January 3, 2008 (edited) ai no jums kautko sagaidiit :( labi tas bija jautaajums kaa uztaisit lai raada meenesi? Edited January 3, 2008 by lazda144 Link to comment Share on other sites More sharing options...
Aleksejs Posted January 3, 2008 Report Share Posted January 3, 2008 0) Tomēr izlasīt - http://www.catb.org/~esr/faqs/smart-questions.html 1) Aiziet uz lapu: http://lv.php.net/date 2) Izlasīt 3) Ieraudzīt, ka date('n',$t) atgriež ciparu, kurš mēnesis. 4) izveidot masīvu $menesi = new Array('Janvāris', ... , 'Decembris'); 5) Apvienot 3. un 4. solī ieraudzīto un iegūt, ka $menesis_teksts = $menesi[date('n',$t)-1]; 6) Ievietot mainīgā $menesis_teksts sev vēlamajā vietā. Link to comment Share on other sites More sharing options...
lazda144 Posted January 3, 2008 Report Share Posted January 3, 2008 itkaa atradu vienu skriptu bet vins nerada garumziimes. kaa uzlikt lai raadiitu garumziimes?? http://paste.php.lv/6682 Link to comment Share on other sites More sharing options...
andrisp Posted January 3, 2008 Report Share Posted January 3, 2008 Varbūt izlabojot tos stringus ? Link to comment Share on other sites More sharing options...
Recommended Posts