Foros del Web » Programando para Internet » PHP »

cambiar dias de la semana a español

Estas en el tema de cambiar dias de la semana a español en el foro de PHP en Foros del Web. no cambies monday ni sunday ya que son verificaciones lo que pasa q en tu calendario siempre estan los numeros en el mismo sitio y ...

  #31 (permalink)  
Antiguo 05/01/2012, 15:06
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

no cambies monday ni sunday ya que son verificaciones

lo que pasa q en tu calendario siempre estan los numeros en el mismo sitio y deberian moverse segun el mes si x ejemplo si el dia 1 es jueves que salga en el recuadro 4 empezando por la izquierda , pero en tu calendario no se mueven , alomejor n e entendido tu pregunta?
  #32 (permalink)  
Antiguo 05/01/2012, 15:29
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 2 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

Antes com el codigo original, cada mes empezaba las semanas por el lunes, ahora cada mes empieza por un dia diferente. hecha un vistazo tu mismo.
http://goversions.com/event_calendar/calendar.php

Puede ser debido a las traducciones?
  #33 (permalink)  
Antiguo 05/01/2012, 15:36
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

abersegun yo lo veo vale los numeros no se mueven siempre estan fijos x eso se mueven los dias para ajustarlos a los numeros , y empieza cada semana x el dia que sea , pregunto yo antes se movian los numeros??
  #34 (permalink)  
Antiguo 05/01/2012, 15:42
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 2 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

si, mira vuelvo a pegar el codigo original i refrescas en un minuto
  #35 (permalink)  
Antiguo 05/01/2012, 15:46
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

vale vale ya lo vi , yo eske desde el pricnipio lo vi como te dije espera q le eche un vistazo a q es debido
  #36 (permalink)  
Antiguo 05/01/2012, 15:48
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 2 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

espera, te pego el codigo actual, por si ves algun cambio:(el segundo que te pegue en la pagina anterior no funciona lo de los dias, puede ser que coguiste un codigo base que havia algun error)

Código PHP:
Ver original
  1. <?php
  2.  
  3. include('admin/dbconn.php');
  4. include('functions/functions.php');
  5.  
  6.  
  7. $first_day_of_week = 'Monday'; // or 'Sunday'
  8.  
  9. $type = CAL_GREGORIAN;
  10.  
  11. if(isset($_GET['month'])) $month = trim(stripslashes(strip_tags($_GET['month'])));
  12. if(isset($_GET['year'])) $year = trim(stripslashes(strip_tags($_GET['year'])));
  13.  
  14. if(!isset($_GET['month']) || !is_numeric($_GET['month'])) $month = date('n'); // Month ID, 1 through to 12.
  15. if(!isset($_GET['year']) || !is_numeric($_GET['year'])) $year = date('Y'); // Year in 4 digit 2009 format.
  16.  
  17. $today = date('Y/n/d');
  18.  
  19. $day_count = cal_days_in_month($type, $month, $year); // Get the amount of days in the chosen month to give to our function.
  20.  
  21. echo "<div id='calendar'>";
  22. echo "<div id='calendar_wrap'>";
  23.  
  24. // Function for year change. //
  25.  
  26. $last_month = $month - 1;
  27. $next_month = $month + 1;
  28.  
  29. $last_year = $year - 1;
  30. $next_year = $year + 1;
  31.  
  32. if($month == 12):
  33.     $change_year = $year;
  34.     $change_month  = $last_month;
  35. elseif($month == 1):
  36.     $change_year = $last_year;
  37.     $change_month  = '12';
  38. else:
  39.     $change_year = $year;
  40.     $change_month  = $last_month;
  41. endif;
  42.  
  43. if($month == 1):
  44.     $change_year_next = $year;
  45.     $change_month_next  = $next_month;
  46. elseif($month == 12):
  47.     $change_year_next = $next_year;
  48.     $change_month_next  = '1';
  49. else:
  50.     $change_year_next = $year;
  51.     $change_month_next  = $next_month;
  52. endif;
  53.  
  54. echo "<div class='title_bar'>";
  55.  
  56. echo "<a href='".$_SERVER['PHP_SELF']."?month=". $change_month ."&year=". $change_year ."'><div class='previous'></div></a>";
  57. echo "<a href='".$_SERVER['PHP_SELF']."?month=". $change_month_next ."&year=". $change_year_next ."'><div class='next'></div></a>";
  58. echo "<h2 class='month'>" . date('F',  mktime(0,0,0,$month,1)) . "&nbsp;" . $year . "</h2>";
  59.  
  60.  
  61. echo "</div>";
  62.  
  63. /* Previous Month */
  64.  
  65. $first_day = date('N', mktime(0,0,0,$month,1,$year));
  66.  
  67. if ( ($first_day_of_week=='Monday' && $first_day != 1) || ($first_day_of_week=='Sunday' && $first_day != 7) ) :
  68.  
  69.     $last_month_day_count = cal_days_in_month($type, $change_month, $change_year);
  70.  
  71.     if ($first_day_of_week=='Monday') :
  72.         if ( 'Monday' == date('l', mktime(0,0,0,$change_month,$last_month_day_count,$change_year)) ) :
  73.             $final_day = date('j', mktime(0,0,0,$change_month,$last_month_day_count,$change_year));
  74.         else :
  75.             $final_day = date('j', strtotime('last Monday', mktime(0,0,0,$change_month,$last_month_day_count,$change_year) ) );
  76.         endif;
  77.     else :
  78.         if ( 'Sunday' == date('l', mktime(0,0,0,$change_month,$last_month_day_count,$change_year)) ) :
  79.             $final_day = date('j', mktime(0,0,0,$change_month,$last_month_day_count,$change_year));
  80.         else :
  81.             $final_day = date('j', strtotime('last Sunday', mktime(0,0,0,$change_month,$last_month_day_count,$change_year) ) );
  82.         endif;
  83.     endif;
  84.  
  85.     // Not a monday so fill the gap
  86.     for($i=$final_day; $i<=$last_month_day_count; $i++):
  87.  
  88.         $date = $change_year.'/'.$change_month.'/'.$i;
  89.  
  90.         $get_name = date('l', strtotime($date));
  91.         $month_name = date('F', strtotime($date));
  92.         $day_name = substr($get_name, 0, 3); // Trim day name to 3 chars
  93.  
  94.         $count = count_events($i,$change_month,$change_year);
  95.         if($count >= 1)
  96.         echo "<a href='day_view.php?day=$i&month=$change_month&year=$change_year' title='$i $month_name' rel='day_view'>";
  97.         echo "<div class='cal_day last_month'>"; // Calendar Day
  98.  
  99.             echo "<div class='day_heading'>" . $day_name . "</div>";
  100.  
  101.             if($count >= 1) echo "<div class='day_count'><span class='event'>" . $count . "</span></div>";
  102.  
  103.             if($today == $date):
  104.                 echo "<div class='day_number today'>" . $i . "</div>";
  105.             else:
  106.                 echo "<div class='day_number'>" . $i . "</div>";
  107.             endif;
  108.  
  109.         echo "</div>";
  110.         echo "</a>";
  111.  
  112.     endfor;
  113.  
  114. endif;
  115.  
  116. /* Current Month */
  117.  
  118. for($i=1; $i<= $day_count; $i++): // Start of for $i
  119.  
  120.     $date = $year.'/'.$month.'/'.$i;
  121.  
  122.     $get_name = date('l', strtotime($date));
  123.     $month_name = date('F', strtotime($date));
  124.     $day_name = substr($get_name, 0, 3); // Trim day name to 3 chars
  125.  
  126.     $count = count_events($i,$month,$year);
  127.     if($count >= 1)
  128.     echo "<a href='day_view.php?day=$i&month=$month&year=$year' title='$i $month_name' rel='day_view'>";
  129.     echo "<div class='cal_day'>"; // Calendar Day
  130.  
  131.         echo "<div class='day_heading'>" . $day_name . "</div>";
  132.  
  133.         if($count >= 1) echo "<div class='day_count'><span class='event'>" . $count . "</span></div>";
  134.  
  135.         if($today == $date):
  136.             echo "<div class='day_number today'>" . $i . "</div>";
  137.         else:
  138.             echo "<div class='day_number'>" . $i . "</div>";
  139.         endif;
  140.  
  141.     echo "</div>";
  142.     echo "</a>";
  143.  
  144. endfor; // EOF for $i
  145.  
  146. /* Next Month */
  147.  
  148. $last_day = date('N', mktime(0,0,0,$month,$day_count,$year));
  149.  
  150. if ( ($first_day_of_week=='Monday' && $last_day != 7) || ($first_day_of_week=='Sunday' && $last_day != 1) ) :
  151.  
  152.     if ($first_day_of_week=='Monday') :
  153.         if ( 'Sunday' == date('l', mktime(0,0,0,$change_month_next,1,$change_year_next)) ) :
  154.             $first_day = date('j', mktime(0,0,0,$change_month_next,1,$change_year_next));
  155.         else :
  156.             $first_day = date('j', strtotime('first Sunday', mktime(0,0,0,$change_month_next,1,$change_year_next) ) );
  157.         endif;
  158.     else :
  159.         if ( 'Saturday' == date('l', mktime(0,0,0,$change_month_next,1,$change_year_next)) ) :
  160.             $first_day = date('j', mktime(0,0,0,$change_month_next,1,$change_year_next));
  161.         else :
  162.             $first_day = date('j', strtotime('first Saturday', mktime(0,0,0,$change_month_next,1,$change_year_next) ) );
  163.         endif;
  164.     endif;
  165.  
  166.  
  167.     // Not a monday so fill the gap
  168.     for($i=1; $i<=$first_day; $i++):
  169.  
  170.         $date = $change_year_next.'/'.$change_month_next.'/'.$i;
  171.  
  172.         $get_name = date('l', strtotime($date));
  173.         $month_name = date('F', strtotime($date));
  174.         $day_name = substr($get_name, 0, 3); // Trim day name to 3 chars
  175.  
  176.         $count = count_events($i,$change_month_next,$change_year_next);
  177.         if($count >= 1)
  178.         echo "<a href='day_view.php?date=$i&month=$change_month_next&year=$change_year_next' title='$i $month_name' rel='day_view'>";
  179.         echo "<div class='cal_day next_month'>"; // Calendar Day
  180.  
  181.             echo "<div class='day_heading'>" . $day_name . "</div>";
  182.  
  183.             if($count >= 1) echo "<div class='day_count'><span class='event'>" . $count . "</span></div>";
  184.  
  185.             if($today == $date):
  186.                 echo "<div class='day_number today'>" . $i . "</div>";
  187.             else:
  188.                 echo "<div class='day_number'>" . $i . "</div>";
  189.             endif;
  190.  
  191.         echo "</div>";
  192.         echo "</a>";
  193.  
  194.     endfor;
  195.  
  196. endif;
  197.  
  198.     echo "</div>";
  199. ?>
  #37 (permalink)  
Antiguo 05/01/2012, 15:51
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

vale ya se x donde van los tiros dentro de un rato t lo subo que ahora voy a cenar ok
  #38 (permalink)  
Antiguo 05/01/2012, 15:51
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 2 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

Vale ya encontre el error, faltaba una lina muy tonta

$first_day_of_week = 'Monday'; // or 'Sunday'
  #39 (permalink)  
Antiguo 05/01/2012, 15:52
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

Aber subelo que yo lo vea en español YA COMPLETO
  #40 (permalink)  
Antiguo 05/01/2012, 15:54
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 2 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

Esta subido! lo que passa que la web és en catalan, =)

http://goversions.com/event_calendar/calendar.php

Gracias por tus aportes
  #41 (permalink)  
Antiguo 05/01/2012, 15:58
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

Ha pues ya esta bien entonces no pues me alegro

aqui estamos pa lo que sea

Etiquetas: calendario, español, traduccion
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 12:18.