Amigos, e pasado estos ultimos dias tratando de resolve un problema, el cual es pasar los meses de un calendario dinamico que tengo de ingles a e`spañol el cual utilize SETLOCALE y funciona perfectamente en mi servidor local pero en el externo NO, e preguntado a mi servidor si se puede abiitar el ideoma español y me dicen que no. Como puedo resolver eso, yo habia pensado en usar ciclo que detectara el ingles ghiciera una comparacion y colocara su corespondiente en español. El codigo completo del calendario es este:
<?php
/***************************************
* Script: NiceCalendar 1.0
* Author: Andyy <mail_at_andyydev.com>
* website: www.AndyyDev.com
***************************************/
class NiceCalendar {
var $month,$year,$data,$tt;
function NiceCalendar($data='',$tooltip=true,$month='',$yea r=''){
$this->month=($month!='')?$month:date('n');
$this->year=($year!='')?$year:date('Y');
$this->data=$data;
$this->tt=$tooltip;
}
function draw(){
$time=mktime(0,0,0,$this->month,1,$this->year);
//echo $time."<BR>";
$lastDay= date('t',$time);
// echo $lastDay."<BR>";
$firstDay=date('w',$time);
//echo $firstDay."<BR>";
$today=date('j');
//echo $today."<BR>";
$i=1;
$days=array('Dom','Lun','Mar','Mier','Jue','Vie',' Sab');
echo '<div id="calendar"><table cellpadding="2" cellspacing="1">';
echo '<tr class="header">';
foreach ($days as $k=>$v) echo '<td class="day">'.$v.'</td>';
echo '</tr>';
while($i<=$lastDay){
echo '<tr>';
for ($j=0;$j<7;$j++){
$note=$this->data[$i.'-'.$this->month.'-'.$this->year];
if(is_array($this->data) && $note) {
if ($this->tt) $day='<span style="margin-top:0px;" id="header=[] body=['.str_replace('“','\'',str_replace('”','\'',str_re place('"','\'',$note[1]))).'] delay=[20] fade=[on] cssbody=[toolbody]" onclick="location.href=\''.$note[0].'\'">'.$i.'</span>';
else $day='<span><a href=\''.$note[0].'\'">'.$i.'</a></span>';
$class='note';
}
else {$day=$i;$class='';}
if($i.$this->month.$this->year==$today.date('nY')) {echo '<td class="row'.($j%2).' current '.$class.'">'.$day.'</td>';$i++;}
elseif(($i!=1 || $firstDay==$j) && $i<=$lastDay) {echo '<td class="row'.($j%2).' '.$class.'">'.$day.'</td>';$i++;}
else echo '<td> </td>';
}
echo '</tr>';
}
if ($this->month==1) {$pmonth=12;$pyear=$this->year-1;} else {$pmonth=$this->month-1;$pyear=$this->year;}
if ($this->month==12) {$nmonth=1;$nyear=$this->year+1;} else {$nmonth=$this->month+1;$nyear=$this->year;}
setlocale(LC_ALL, 'spanish-modern' );//Linea para cambiar el mes en español
// $loc = setlocale(LC_TIME, NULL);//Linea para cambiar el mes en español $time2=strftime(" %B %Y", mktime(0,0,0,$this->month,1,$this->year));//Linea para cambiar el mes en español strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));
/* if($mes=$time=='enero 2006') $mes='Enero';
if($mes=date('F',$time)=='February') $mes='Febrero';
if($mes=date('F',$time)=='March') $mes='Marzo';
if($mes=date('F',$time)=='April') $mes='Abril';
if($mes=date('F',$time)=='May') $mes='Mayo';
if($mes=date('F',$time)=='June') $mes='Junio';
if($mes=date('F',$time)=='July') $mes='Julio';
if($mes=date('F',$time)=='August') $mes='Agosto';
if($mes=date('F',$time)=='September') $mes='Septiembre';
if($mes=date('F',$time)=='October') $mes='Octubre';
if($mes=date('F',$time)=='November') $mes='Noviembre';
if($mes=date('F',$time)=='December') $mes='Diciembre';*/
$query_str=str_replace('&month='.$this->month.'&year='.$this->year,'',$_SERVER['QUERY_STRING']);
$query_str=str_replace('?month='.$this->month.'&year='.$this->year,'',$query_str);
$page=($_SERVER['QUERY_STRING'])?$_SERVER['PHP_SELF'].'?'.$query_str.'&':$_SERVER['PHP_SELF'].'?';
echo '<tr><td><a href="'.$page.'month='.$pmonth.'&year='.$pyear.'#c alendar">«</a></td><td colspan="5"><b>'.date('F',$time).'</b> <span class="y">'./*date('Y',$time).*/'</span></td><td><a href="'.$page.'month='.$nmonth.'&year='.$nyear.'#c alendar">»</a></td></tr>';
echo '</table></div>';
echo $nmonth;
}
}
?>
<!-- Begin include in <head>-->
<style>
/*Save this in NiceCalendar.css*/
/*General*/
#calendar td{background:#fff;text-align:center;}
#calendar table{background:#ccc}
#calendar .row0 {background:#F4F4F4;}
#calendar .row1 {background:#E9E9E9;}
#calendar .current {font-weight:bold;border:1px solid #000;}
#calendar .day {width:30px;background:#ccc}
#calendar .y {color:#999}
/* ToolTip for notes */
.toolbody {background-color:#fff;padding:5px;border:1px solid #666;width:150px;}
/*Cells with notes*/
#calendar .note {background:#5580C0;}
#calendar .note span {background:#9AD5F1;display:block;margin:0;}
#calendar .note a {text-decoration:none}
</style>
<script src="NiceCalendar.js"></script>
<!-- End include in <head>-->
<?
$conectar=mysql_connect('localhost','root','') or die("No se puede establecer conexión con el servidor");
mysql_select_db('unerg4',$conectar);
$result=mysql_query("select * from eventos ",$conectar);
$var = array();
while($valor=mysql_fetch_array($result))
{
//echo "<br>".$valor['fecha'];
$f=$valor['fecha'];
//echo "<br>".$valor['link'];
$l=$valor['link'];
//echo "<br>".$valor['cita'];
$c=$valor['cita'];
//echo "<br>********************";
$var[$f] = array("$l","$c");
}
/*Aqui se colocas los eventos por cada dias y con enlace si quieres*/
/*$var=array(
'1-7-2006'=>array('blog.php?id=01072006','A day to remember'),
'12-7-2006'=>array('#','Don\'t need any link'),
'26-7-2006'=>array('http://www.google.com','Debo revisar google'),
'30-7-2006'=>array('#','Debo ir a Clasesfgfdgfxgdfxgxcfgxcfbxcfghxdfghfggh dfghxdfgxdfgdfx !!'),
'31-7-2006'=>array('#','Debo ir a Clasesfgfdgfxgdfxgxcfgxcfbxcfghxdfghfggh dfghxdfgxdfgdfx !!'),
'11-6-2006'=>array('#','Also for previous Month !!')
);*/
// $calendar = new NiceCalendar($remind,1,$_GET['month'],$_GET['year']);
$calendar = new NiceCalendar($var,1,$_GET['month'],$_GET['year']);
$calendar->draw();
?>
Alguien me ayuda o por lo menos que coloque las siglas del mes en español?