Traduction ...
Français
FrançaisEnglishGermanSpanishItalianPortugueseFinnishHindiJapaneseChinese (Simplified)ArabicThaiRussian
intro-btn1 intro-btn2 intro-btn3
Hack FR pour le plugin YouJoomla Date
By Patrick BESSE - See by 1047 visiteurs

La date de type calendrier formatée en français dans le CMS Joomla.

Le plugin YouJoomla Date, n'affiche pas correctement la date en français ? Voici un petit hack pour réparer ce défaut.


Dans le fichier yj_date.php, recherchez et remplacez la ligne ci-dessous :


$format_date = date("d-M-Y", @mktime(0, 0, 0, $date_display[1], $date_display[2], $date_display[0]));


par :


$format_date = iconv('ISO-8859-1', 'UTF-8', strftime("%d-%b-%Y", @mktime(0, 0, 0, $date_display[1], $date_display[2], $date_display[0])));


Et voila !

Vous pouvez voir le résultat à la gauche du titre de cet article, la date est bien dans la langue de Molière.


Dernière version :

Pour optimiser un peu, j'ai supprimé ce plugin pour intégrer la date formatée directement dans les fichiers templates de Joomla.


templates/mytemplate/html/article/default.php

 <?php if ($this->params->get('show_create_date')) : ?>
  <?php 
   //generate date to display
   $date_format = JHTML::_('date', $this->article->created, JText::_('DATE_FORMAT_LC2'));
   $final_date = explode(" ",$date_format);
   $displaydate = "<div class=\"date\">
       <div class=\"date_day\">".$final_date[1]."</div>
       <div class=\"date_month\">".mb_substr($final_date[2], 0, 3,'UTF-8').".</div>
       <div class=\"date_year\">".$final_date[3]."</div>
       </div>";
    echo $displaydate;
   ?>
 <?php endif; ?> 


templates/mytemplate/css/template.css

/* affichage date format vertical dans template article*/
.date {
 width: 32px;
 height: 42px;
 overflow: hidden;
 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
 margin-left: 0px;
 margin-right: 2px;
 margin-top: 3px;
 margin-bottom: 0px;
 border-right: 1px dotted #666666;
 text-align: center;
}
.date_day {
   font-weight: bold;
 text-align: left;
 color:#666666;
 font-size:20px;
 line-height: 22px;
 margin-top: -6px;
}
.date_month {
   font-weight: bold;
 text-align: center;
 color:#666666;
 font-size:11px;
 margin-top: -2px;
}
.date_year {
 text-align: center;
 color:#888;
 font-size:9px;
 margin-top: -2px;
}
/* affichage date format vertical dans template article*/








Last Updated on Tuesday, 01 September 2009 15:57
Articles recents
Articles les plus lus
Login
No Account Yet? Click here
   
   
Espace Téléchargement et Support
Ce téléchargement est réservé aux membres du service support.
Pour y accéder, vous devez acheter, ou renouveler, un produit avec abonnement au service support.