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. Buenas, soy desarrollador de paginas web, pero tengo pocos conocimientos (entiéndase por pocos.. 0 ) de php. Tengo un cliente que necesitaba un calendario de ...

  #1 (permalink)  
Antiguo 05/01/2012, 11:08
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
cambiar dias de la semana a español

Buenas, soy desarrollador de paginas web, pero tengo pocos conocimientos (entiéndase por pocos.. 0 ) de php. Tengo un cliente que necesitaba un calendario de eventos en su web y conseguí un estupendo calendario.. en ingles.
Así que no consigo traducirlo de ningún modo, espero que algún crack pueda echarme una mano, siempre podemos hablar de la recompensa.

Codigo:

<?php

include('admin/dbconn.php');
include('functions/functions.php');

$first_day_of_week = 'Monday'; // or 'Sunday'

$type = CAL_GREGORIAN;

if(isset($_GET['month'])) $month = trim(stripslashes(strip_tags($_GET['month'])));
if(isset($_GET['year'])) $year = trim(stripslashes(strip_tags($_GET['year'])));

if(!isset($_GET['month']) || !is_numeric($_GET['month'])) $month = date('n'); // Month ID, 1 through to 12.
if(!isset($_GET['year']) || !is_numeric($_GET['year'])) $year = date('Y'); // Year in 4 digit 2009 format.

$today = date('Y/n/d');

$day_count = cal_days_in_month($type, $month, $year); // Get the amount of days in the chosen month to give to our function.

echo "<div id='calendar'>";
echo "<div id='calendar_wrap'>";

// Function for year change. //

$last_month = $month - 1;
$next_month = $month + 1;

$last_year = $year - 1;
$next_year = $year + 1;

if($month == 12):
$change_year = $year;
$change_month = $last_month;
elseif($month == 1):
$change_year = $last_year;
$change_month = '12';
else:
$change_year = $year;
$change_month = $last_month;
endif;

if($month == 1):
$change_year_next = $year;
$change_month_next = $next_month;
elseif($month == 12):
$change_year_next = $next_year;
$change_month_next = '1';
else:
$change_year_next = $year;
$change_month_next = $next_month;
endif;

echo "<div class='title_bar'>";

echo "<a href='".$_SERVER['PHP_SELF']."?month=". $change_month ."&year=". $change_year ."'><div class='previous'></div></a>";
echo "<a href='".$_SERVER['PHP_SELF']."?month=". $change_month_next ."&year=". $change_year_next ."'><div class='next'></div></a>";
echo "<h2 class='month'>" . date('F', mktime(0,0,0,$month,1)) . "&nbsp;" . $year . "</h2>";


echo "</div>";

/* Previous Month */

$first_day = date('N', mktime(0,0,0,$month,1,$year));

if ( ($first_day_of_week=='Monday' && $first_day != 1) || ($first_day_of_week=='Sunday' && $first_day != 7) ) :

$last_month_day_count = cal_days_in_month($type, $change_month, $change_year);

if ($first_day_of_week=='Monday') :
if ( 'Monday' == date('l', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year)) ) :
$final_day = date('j', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year));
else :
$final_day = date('j', strtotime('last Monday', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year) ) );
endif;
else :
if ( 'Sunday' == date('l', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year)) ) :
$final_day = date('j', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year));
else :
$final_day = date('j', strtotime('last Sunday', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year) ) );
endif;
endif;

// Not a monday so fill the gap
for($i=$final_day; $i<=$last_month_day_count; $i++):

$date = $change_year.'/'.$change_month.'/'.$i;

$get_name = date('l', strtotime($date));
$month_name = date('F', strtotime($date));
$day_name = substr($get_name, 0, 3); // Trim day name to 3 chars

$count = count_events($i,$change_month,$change_year);
if($count >= 1)
echo "<a href='day_view.php?day=$i&month=$change_month&year =$change_year' title='$i $month_name' rel='day_view'>";
echo "<div class='cal_day last_month'>"; // Calendar Day

echo "<div class='day_heading'>" . $day_name . "</div>";

if($count >= 1) echo "<div class='day_count'><span class='event'>" . $count . "</span></div>";

if($today == $date):
echo "<div class='day_number today'>" . $i . "</div>";
else:
echo "<div class='day_number'>" . $i . "</div>";
endif;

echo "</div>";
echo "</a>";

endfor;

endif;

/* Current Month */

for($i=1; $i<= $day_count; $i++): // Start of for $i

$date = $year.'/'.$month.'/'.$i;

$get_name = date('l', strtotime($date));
$month_name = date('F', strtotime($date));
$day_name = substr($get_name, 0, 3); // Trim day name to 3 chars

$count = count_events($i,$month,$year);
if($count >= 1)
echo "<a href='day_view.php?day=$i&month=$month&year=$year' title='$i $month_name' rel='day_view'>";
echo "<div class='cal_day'>"; // Calendar Day

echo "<div class='day_heading'>" . $day_name . "</div>";

if($count >= 1) echo "<div class='day_count'><span class='event'>" . $count . "</span></div>";

if($today == $date):
echo "<div class='day_number today'>" . $i . "</div>";
else:
echo "<div class='day_number'>" . $i . "</div>";
endif;

echo "</div>";
echo "</a>";

endfor; // EOF for $i

/* Next Month */

$last_day = date('N', mktime(0,0,0,$month,$day_count,$year));

if ( ($first_day_of_week=='Monday' && $last_day != 7) || ($first_day_of_week=='Sunday' && $last_day != 1) ) :

if ($first_day_of_week=='Monday') :
if ( 'Sunday' == date('l', mktime(0,0,0,$change_month_next,1,$change_year_nex t)) ) :
$first_day = date('j', mktime(0,0,0,$change_month_next,1,$change_year_nex t));
else :
$first_day = date('j', strtotime('first Sunday', mktime(0,0,0,$change_month_next,1,$change_year_nex t) ) );
endif;
else :
if ( 'Saturday' == date('l', mktime(0,0,0,$change_month_next,1,$change_year_nex t)) ) :
$first_day = date('j', mktime(0,0,0,$change_month_next,1,$change_year_nex t));
else :
$first_day = date('j', strtotime('first Saturday', mktime(0,0,0,$change_month_next,1,$change_year_nex t) ) );
endif;
endif;


// Not a monday so fill the gap
for($i=1; $i<=$first_day; $i++):

$date = $change_year_next.'/'.$change_month_next.'/'.$i;

$get_name = date('l', strtotime($date));
$month_name = date('F', strtotime($date));
$day_name = substr($get_name, 0, 3); // Trim day name to 3 chars

$count = count_events($i,$change_month_next,$change_year_ne xt);
if($count >= 1)
echo "<a href='day_view.php?date=$i&month=$change_month_nex t&year=$change_year_next' title='$i $month_name' rel='day_view'>";
echo "<div class='cal_day next_month'>"; // Calendar Day

echo "<div class='day_heading'>" . $day_name . "</div>";

if($count >= 1) echo "<div class='day_count'><span class='event'>" . $count . "</span></div>";

if($today == $date):
echo "<div class='day_number today'>" . $i . "</div>";
else:
echo "<div class='day_number'>" . $i . "</div>";
endif;

echo "</div>";
echo "</a>";

endfor;

endif;

echo "</div>";
?>
  #2 (permalink)  
Antiguo 05/01/2012, 11:15
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

creando arrays y cambaindo los parametros x los que tienes

Código PHP:
Ver original
  1. date_default_timezone_set('Europe/Madrid');
  2. $calendario_dias = array('Domingo','Lunes','Martes','Miercoles','Jueves','Viernes','Sábado');
  3. $calendario_meses = array('Diciembre','Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre');
  4. $calendario_final = ' '.$calendario_dias[date('w')].' '.date('d').' de '.$calendario_meses[date('n')].' '.date('o').' - '.date('H:i:s').'';
  #3 (permalink)  
Antiguo 05/01/2012, 11:27
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

donde coloco este codigo?
  #4 (permalink)  
Antiguo 05/01/2012, 11:32
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

no es colocarlo y ya esta xq nt funcionara , debes adaptarlo a tu script , tampoco se te va a dar todo echo no , tu crees que asi aprenderias?
  #5 (permalink)  
Antiguo 05/01/2012, 11:33
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

vale, entiendo pero alguna pista? que valores debo cambiar y donde buscarlos?
  #6 (permalink)  
Antiguo 05/01/2012, 11:35
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

te voy a dar unas pistas añade las 3 primeras lineas debajo del include y luego tienes que modificar todas las variables de date() donde kieras que se muestre el dia o el mes
  #7 (permalink)  
Antiguo 05/01/2012, 11:36
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

esta linea q t di es un ejemplo de como modificarlo

$fecha = ' '.$calendario_dias[date('w')].' '.date('d').' de '.$calendario_meses[date('n')].' '.date('o').' - '.date('H:i:s').'';

si te fijas añado la variable del array delante de el date() para que el resultado november me lo cambia por noviembre por ejemplo
  #8 (permalink)  
Antiguo 05/01/2012, 11:48
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

Es decir, esta linia por ejemplo

$first_day = date('N', mktime(0,0,0,$month,1,$year));

debe convertirse en:
$first_day = ' '.$calendario_dias[date('w')].' '.date('N', mktime(0,0,0,$month,1,$year));
  #9 (permalink)  
Antiguo 05/01/2012, 11:48
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

dime exactamnete en que lineas es donde kieres cambiar el valor xq alomejor debes cambiar el valor de date() o el array

y ya te doy un ejemplo para q puedas seguir tu
  #10 (permalink)  
Antiguo 05/01/2012, 11:50
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

Me dijiste que todas las linias que contenga:
date()
  #11 (permalink)  
Antiguo 05/01/2012, 11:53
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

si pero algunas solo muestras el numero y no el nombre , entnces solo cambia las que muestren el nombre las que sean numero no seran necesario
  #12 (permalink)  
Antiguo 05/01/2012, 11:53
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

Yo quiero que el calendario se muestre en español, y realmente es la primera vez que tengo que lidiar con php asi que voy muy perdido. lo hago lo mejor que puedo. Ademas no soy el autor del codigo base asi que doble dificultad-

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

este es el calendario en question. Lo suyo seria cambiar la que aparece encima del numero y el titulo de los meses.
  #13 (permalink)  
Antiguo 05/01/2012, 11:55
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

si es facil solo t lo explico para q lo aprendas paso x paso
  #14 (permalink)  
Antiguo 05/01/2012, 11:58
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

te mirop las lineas q debes modicar y na mas espera un segundo
  #15 (permalink)  
Antiguo 05/01/2012, 11:59
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

como localizo las date() que solo contengan nombre? el codigo està lleno de dates.

$first_day = date('N', mktime(0,0,0,$month,1,$year));

$get_name = date('l', strtotime($date));

pd: te lo estas currando en verdad, gracias.
  #16 (permalink)  
Antiguo 05/01/2012, 12:08
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

solo modificas los que contenga (F mayuscula y lo cambias por n minuscula)(L minuscula por w minuscula)

asi por ejemplo

Código PHP:
Ver original
  1. $get_name = $dias[date('w'], strtotime($date));
  2. $month_name = $meses[date('n'], strtotime($date));

y justo despues de los includes

Código PHP:
Ver original
  1. date_default_timezone_set('Europe/Madrid');
  2.     $dias = array('Domingo','Lunes','Martes','Miercoles','Jueves','Viernes','Sábado');
  3.     $meses = array('Diciembre','Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre');

Última edición por webankenovi; 05/01/2012 a las 12:16
  #17 (permalink)  
Antiguo 05/01/2012, 12:17
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

He hecho los cambios y me sale esto:
http://goversions.com/event_calendar/calendar.php

pego el codigo:


<?php


include('admin/dbconn.php');
include('functions/functions.php');
date_default_timezone_set('Europe/Madrid');
$dias = array('Domingo','Lunes','Martes','Miercoles','Juev es','Viernes','Sábado');
$meses = array('Diciembre','Enero','Febrero','Marzo','Abril ','Mayo','Junio','Julio','Agosto','Septiembre','Oc tubre','Noviembre');


$first_day_of_week = 'Monday'; // or 'Sunday'

$type = CAL_GREGORIAN;

if(isset($_GET['month'])) $month = trim(stripslashes(strip_tags($_GET['month'])));
if(isset($_GET['year'])) $year = trim(stripslashes(strip_tags($_GET['year'])));

if(!isset($_GET['month']) || !is_numeric($_GET['month'])) $month = date('n'); // Month ID, 1 through to 12.
if(!isset($_GET['year']) || !is_numeric($_GET['year'])) $year = date('Y'); // Year in 4 digit 2009 format.

$today = date('Y/n/d');

$day_count = cal_days_in_month($type, $month, $year); // Get the amount of days in the chosen month to give to our function.

echo "<div id='calendar'>";
echo "<div id='calendar_wrap'>";

// Function for year change. //

$last_month = $month - 1;
$next_month = $month + 1;

$last_year = $year - 1;
$next_year = $year + 1;

if($month == 12):
$change_year = $year;
$change_month = $last_month;
elseif($month == 1):
$change_year = $last_year;
$change_month = '12';
else:
$change_year = $year;
$change_month = $last_month;
endif;

if($month == 1):
$change_year_next = $year;
$change_month_next = $next_month;
elseif($month == 12):
$change_year_next = $next_year;
$change_month_next = '1';
else:
$change_year_next = $year;
$change_month_next = $next_month;
endif;

echo "<div class='title_bar'>";

echo "<a href='".$_SERVER['PHP_SELF']."?month=". $change_month ."&year=". $change_year ."'><div class='previous'></div></a>";
echo "<a href='".$_SERVER['PHP_SELF']."?month=". $change_month_next ."&year=". $change_year_next ."'><div class='next'></div></a>";
echo "<h2 class='month'>" . date('n', mktime(0,0,0,$month,1)) . "&nbsp;" . $year . "</h2>";


echo "</div>";

/* Previous Month */

$first_day = date('N', mktime(0,0,0,$month,1,$year));

if ( ($first_day_of_week=='Monday' && $first_day != 1) || ($first_day_of_week=='Sunday' && $first_day != 7) ) :

$last_month_day_count = cal_days_in_month($type, $change_month, $change_year);

if ($first_day_of_week=='Monday') :
if ( 'Monday' == date('l', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year)) ) :
$final_day = date('j', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year));
else :
$final_day = date('j', strtotime('last Monday', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year) ) );
endif;
else :
if ( 'Sunday' == date('w', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year)) ) :
$final_day = date('j', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year));
else :
$final_day = date('j', strtotime('last Sunday', mktime(0,0,0,$change_month,$last_month_day_count,$ change_year) ) );
endif;
endif;

// Not a monday so fill the gap
for($i=$final_day; $i<=$last_month_day_count; $i++):

$date = $change_year.'/'.$change_month.'/'.$i;

$get_name = date('w', strtotime($date));
$month_name = date('n', strtotime($date));
$day_name = substr($get_name, 0, 3); // Trim day name to 3 chars

$count = count_events($i,$change_month,$change_year);
if($count >= 1)
echo "<a href='day_view.php?day=$i&month=$change_month&year =$change_year' title='$i $month_name' rel='day_view'>";
echo "<div class='cal_day last_month'>"; // Calendar Day

echo "<div class='day_heading'>" . $day_name . "</div>";

if($count >= 1) echo "<div class='day_count'><span class='event'>" . $count . "</span></div>";

if($today == $date):
echo "<div class='day_number today'>" . $i . "</div>";
else:
echo "<div class='day_number'>" . $i . "</div>";
endif;

echo "</div>";
echo "</a>";

endfor;

endif;

/* Current Month */

for($i=1; $i<= $day_count; $i++): // Start of for $i

$date = $year.'/'.$month.'/'.$i;

$get_name = date('w', strtotime($date));
$month_name = date('n', strtotime($date));
$day_name = substr($get_name, 0, 3); // Trim day name to 3 chars

$count = count_events($i,$month,$year);
if($count >= 1)
echo "<a href='day_view.php?day=$i&month=$month&year=$year' title='$i $month_name' rel='day_view'>";
echo "<div class='cal_day'>"; // Calendar Day

echo "<div class='day_heading'>" . $day_name . "</div>";

if($count >= 1) echo "<div class='day_count'><span class='event'>" . $count . "</span></div>";

if($today == $date):
echo "<div class='day_number today'>" . $i . "</div>";
else:
echo "<div class='day_number'>" . $i . "</div>";
endif;

echo "</div>";
echo "</a>";

endfor; // EOF for $i

/* Next Month */

$last_day = date('N', mktime(0,0,0,$month,$day_count,$year));

if ( ($first_day_of_week=='Monday' && $last_day != 7) || ($first_day_of_week=='Sunday' && $last_day != 1) ) :

if ($first_day_of_week=='Monday') :
if ( 'Sunday' == date('w', mktime(0,0,0,$change_month_next,1,$change_year_nex t)) ) :
$first_day = date('j', mktime(0,0,0,$change_month_next,1,$change_year_nex t));
else :
$first_day = date('j', strtotime('first Sunday', mktime(0,0,0,$change_month_next,1,$change_year_nex t) ) );
endif;
else :
if ( 'Saturday' == date('w', mktime(0,0,0,$change_month_next,1,$change_year_nex t)) ) :
$first_day = date('j', mktime(0,0,0,$change_month_next,1,$change_year_nex t));
else :
$first_day = date('j', strtotime('first Saturday', mktime(0,0,0,$change_month_next,1,$change_year_nex t) ) );
endif;
endif;


// Not a monday so fill the gap
for($i=1; $i<=$first_day; $i++):

$date = $change_year_next.'/'.$change_month_next.'/'.$i;

$get_name = date('l', strtotime($date));
$month_name = date('n', strtotime($date));
$day_name = substr($get_name, 0, 3); // Trim day name to 3 chars

$count = count_events($i,$change_month_next,$change_year_ne xt);
if($count >= 1)
echo "<a href='day_view.php?date=$i&month=$change_month_nex t&year=$change_year_next' title='$i $month_name' rel='day_view'>";
echo "<div class='cal_day next_month'>"; // Calendar Day

echo "<div class='day_heading'>" . $day_name . "</div>";

if($count >= 1) echo "<div class='day_count'><span class='event'>" . $count . "</span></div>";

if($today == $date):
echo "<div class='day_number today'>" . $i . "</div>";
else:
echo "<div class='day_number'>" . $i . "</div>";
endif;

echo "</div>";
echo "</a>";

endfor;

endif;

echo "</div>";
?>
  #18 (permalink)  
Antiguo 05/01/2012, 12:21
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

no no mal echo solo cambias el valor de date() esperra unos minutos y t lo doy pero x lo menos ya sabes como es mas o menos , en cuanto veas como lo ice yo te daras cuenta ya de como se hace para futuras modificacioens
  #19 (permalink)  
Antiguo 05/01/2012, 12:38
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

aber pruebalo y ay me cuentas que sucedio

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

Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /home/goversio/public_html/event_calendar/calendar.php on line 140

La linia 140 corresponde al primer cambio supongo:

if ( 'Monday' == date($bb, mktime(0,0,0,$change_month,$last_month_day_count,$ change_year)) ) :
  #21 (permalink)  
Antiguo 05/01/2012, 12:45
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

pero ske segun tu me diste el codigo como lo tenias ya venia con errores , aun asi lo ice mal


vale vale fuen un error de copiar y pegar espera
  #22 (permalink)  
Antiguo 05/01/2012, 12:47
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

Te passo el codigo base( que funciona):

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

Última edición por ugluck; 05/01/2012 a las 12:52
  #23 (permalink)  
Antiguo 05/01/2012, 12:58
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

prueba asi para ver que ssucede y ya continuamos

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

ahora mismo solo te modificara el mes principla que sale al lado del año arriba del calendario que ya lo vi
  #24 (permalink)  
Antiguo 05/01/2012, 13:01
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

Bien! me ha traducido los meses! sin embargo los dias los continua presentando en ingles, hecha un vistazo:
[URL="http://goversions.com/event_calendar/calendar.php"]http://goversions.com/event_calendar/calendar.php[/URL]

pd: muchissimas gracias por cierto.
  #25 (permalink)  
Antiguo 05/01/2012, 13:03
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

ademas te puse un epacio q keda mejor entre el mes y el año ,,

ahora kieres cambiar las 3 letras del dia de encima del numero?? y ya esta no
  #26 (permalink)  
Antiguo 05/01/2012, 13:08
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

si, exacto.
mon--> lun
etc..
  #27 (permalink)  
Antiguo 05/01/2012, 13:15
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

vamos a ver

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

y tienes mal exo algo que el mes 12 arriba del calendario no lo muestra
  #28 (permalink)  
Antiguo 05/01/2012, 13:17
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

Eres un fenomeno. Te estoy muy agradecido

Me as ayudado un monton. Yo soy diseñador gràfico y web ( html y css), si nunca necesitas una mano( me imagino que con programacion no xD) passate por www.meltika.com y contacta conmigo!
  #29 (permalink)  
Antiguo 05/01/2012, 13:19
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: cambiar dias de la semana a español

si necesitas algun script para algun cliente yo t los puedo desarrollar por un precio acordado jeje

entnces ya funciona no ademas ya lo vi jeje

si necesito algun dia algo de diseño ya tengo un amigo a quien acudir ejje un saludo
  #30 (permalink)  
Antiguo 05/01/2012, 14:52
 
Fecha de Ingreso: enero-2012
Mensajes: 21
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: cambiar dias de la semana a español

Una ultima pregunta, para poner el lunes como dia inicial como estaba antes?, he intentado cambiar la palabra sunday por monday pero no funciona.

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 03:44.