ugrás a tartalomhoz

naptár következő hónapra léptetése

Anonymous · 2005. Szep. 11. (V), 18.13
Sziasztok!

Készítettem egy natár programot, de amikor léptetem nem írja ki a tartalmat csak akkor ha az ép aktuálos hónap mon van a rendszer is.
De ezt minden évben megteszi de csak a szeptembert írja ki. Az most az aktuális
Ez végezné a lapozást:
  1. <?php  
  2. if($_GET['month']==13){  
  3. $next_month=2;  
  4. $next_year=$_GET['year']+1;  
  5. }  
  6. else$next_month=$_GET['month']+1;  
  7. $next_year=$_GET['year'];}  
  8. echo "<a href=\"$PHP_SELF?month=$next_month&year=$next_year\">&gt;</a>";  
Köszi Tamás
 
1

Mikor lesz 13?

-zsolti- · 2005. Szep. 12. (H), 08.53
Nem nagyon értem ennyi kis kódrészletből, hogy pl. a month mikor lesz 13, én így képzelném el:
  1. <?php  
  2. if($_GET['month'] == 12) { // december esetén  
  3.   $next_month = 1;  
  4.   $next_year = $_GET['year']+1;  
  5. }  
  6. else { // január-november esetén  
  7.   $next_month = $_GET['month']+1;  
  8.   $next_year = $_GET['year'];  
  9. }  
  10.   
  11. echo "<a href=\"$PHP_SELF?month=$next_month&year=$next_year\">&gt;</a>";  
  12. ?>  
Üdvözlettel: Liebig Zsolt
SWEN Internet
2

de még így se jó

Anonymous · 2005. Szep. 12. (H), 18.44
kijavítottam a 13 at 12 re de még így is csak egy hónapot jelenít meg?
Vajon mitől lehet?
3

Kód?

-zsolti- · 2005. Szep. 12. (H), 22.39
Kéne a teljes kód, vagy class, mert sajnos nem vagyok gondolatolvasó....

Üdvözlettel: Liebig Zsolt
SWEN Internet
4

teljes naptár

Anonymous · 2005. Szep. 12. (H), 23.12
  1. <?php  
  2. if(!isset($_GET['month']))  
  3. $_GET['month']=date('n')+1;}  
  4. if(!isset($_GET['year']))  
  5. $_GET['year']=date('Y');}  
  6. echo $_GET['month'];  
  7. $this_month=date('n');  
  8. $this_day=date('j');  
  9.   
  10. $timestamp=mktime(0,0,0,$_GET['month'],1,$_GET['year']);  
  11. $days_in_month=date("t",$timestamp);  
  12. $first_day_of_month=date("w",$timestamp-(60*60*24*date("n")));  
  13. date("F Y"mktime(0,0,0,$_GET['month']-1,1,$_GET['year']));  
  14.   
  15. if($_GET['month']==12){ //goto next month begin  
  16. $next_month=1;  
  17. $next_year=$_GET['year']+1;  
  18. }  
  19. else$next_month=$_GET['month']+1;  
  20. $next_year=$_GET['year'];}  
  21. echo "<a href='$PHP_SELF?month=$next_month&year=$next_year.'>&nbsp;next month&gt;</a>"//go to next month end  
  22.   
  23. echo"<center><table width=50% height=50% border=1>"// calendar write is begin  
  24. echo"<tr>";  
  25. $days=array('sun''mon''tue''wed''thu''fri''sat'); //day of week  
  26. foreach($days as $day)  
  27. {  
  28. echo"<td align=\"center\">$day</td>";  
  29. }  
  30. echo"</tr>";  
  31. $day_so_far=0;  
  32. $count_boxes=0;  
  33. for($i=1; $i<$first_day_of_month+1; $i++)  
  34. {  
  35. $day_so_far+=1;  
  36. $count_boxes+=1;  
  37. echo"<td bgcolor=#36fc6c></td>";}  
  38. for($i=1; $i<$days_in_month$i++)  
  39. {  
  40. $day_so_far+1;  
  41. $count_boxes+=1;  
  42. if($_GET['month']==$this_month+1)  
  43. {  
  44. if($i==$this_day)  
  45. {  
  46. echo"<td bgcolor=#ff114d>$i</td>";  
  47. }  
  48. elseif($first_day_of_month==0)  
  49. {  
  50. echo"<td align=\"center\">$i</td>";  
  51. }  
  52. else  
  53. {  
  54. echo"<td align=\"center\" bgcolor=#fbf943>$i</td>";  
  55. }  
  56.  }  
  57.   
  58. if(($count_boxes==7) and ($day_so_far!=$first_day_of_month+$days_in_month))  
  59. {  
  60. $count_boxes=0;  
  61. echo "</tr><tr>";  
  62. }  
  63.  }  
  64. $extra_boxes=7-$count_boxes;  
  65. for($i=1; $i<=$extra_boxes$i++)  
  66. {  
  67. echo "<td bgcolor='#1efe66' bordercolor=#12680a></td>";  
  68. }  
  69. echo"</tr></table></center>"//calendar write is end  
  70.   
  71. ?>  
5

Javított verzió

Anonymous · 2005. Szep. 13. (K), 16.14
Szia!

Én is pont ilyesmit akarok készíteni, így kapóra jött a Te alapod. Engedelmeddel részben felhasználnám a kódodat, cserébe itt van a javított forrás (több hibát is találtam, nekem így működik).

D.
  1. <?php  
  2. if(!isset($_GET['month'])) { $_GET['month']=date('n'); }  
  3. if(!isset($_GET['year'])) { $_GET['year']=date('Y'); }  
  4. echo $_GET['month']."<br><br>";  
  5. $this_month=date('n');  
  6. $this_day=date('j');  
  7.   
  8. $timestamp=mktime(0,0,0,$_GET['month'],1,$_GET['year']);  
  9. $days_in_month=date("t",$timestamp);  
  10. $first_day_of_month=date("w",$timestamp);  
  11.   
  12. echo date("F Y"mktime(0,0,0,$_GET['month'],1,$_GET['year']));  
  13.   
  14. if($_GET['month']==12){ //goto next month begin  
  15.     $next_month=1;  
  16.     $next_year=$_GET['year']+1;  
  17. }  
  18. else {  
  19.     $next_month=$_GET['month']+1;  
  20.     $next_year=$_GET['year'];  
  21. }  
  22.   
  23. echo "<br><a href='$PHP_SELF?month=$next_month&year=$next_year'>&nbsp;next month&gt;</a>"//go to next month end  
  24.   
  25. echo"<center><table width=50% height=50% border=1>\r"// calendar write is begin  
  26. echo"<tr>\r";  
  27.   
  28. $days=array('sun''mon''tue''wed''thu''fri''sat'); //day of week  
  29.   
  30. foreach($days as $day) {  
  31.     echo"<td align=\"center\">$day</td>\r";  
  32. }  
  33.   
  34. echo"</tr>\r";  
  35.   
  36. $day_so_far=0;  
  37. $count_boxes=0;  
  38.   
  39. for($i=1; $i<$first_day_of_month+1; $i++) {  
  40.     $day_so_far+=1;  
  41.     $count_boxes+=1;  
  42.     echo"<td bgcolor=#36fc6c>e</td>\r";  
  43. }  
  44.   
  45. for($i=1; $i<=$days_in_month$i++) {  
  46.     $day_so_far+=1;  
  47.     $count_boxes+=1;  
  48.         if($i==$this_day) {  
  49.             echo"<td bgcolor=#ff114d>$i</td>\r";  
  50.         }  
  51.         else {  
  52.             echo"<td align=\"center\" bgcolor=#fbf943>$i</td>\r";  
  53.         }  
  54.       
  55.     if(($count_boxes==7) and ($day_so_far!=$first_day_of_month+$days_in_month)) {  
  56.         $count_boxes=0;  
  57.         echo "</tr><tr>\r";  
  58.     }  
  59. }  
  60.   
  61. $extra_boxes=7-$count_boxes;  
  62.   
  63. for($i=1; $i<=$extra_boxes$i++) {  
  64.     echo "<td bgcolor='#1efe66' bordercolor=#12680a>u</td>\r";  
  65. }  
  66.   
  67. echo"</tr></table></center>"//calendar write is end  
  68. ?>  
6

Javítás

Anonymous · 2005. Szep. 13. (K), 16.34
Még egy <tr> -szúrj be a napok sor után!
7

használd csak

Anonymous · 2005. Szep. 13. (K), 21.00
köszi a segítséget.
Használd nyugodtan .