Hi folks
I have a little issue, that I cannot fix because of a lack of knowledge on the web characters encodage.
The problem I have is with the “é” char of “décembre” when i want to display the current month + year of a calendar.
Here is a capture of my website
And my code :
$callbackYear = function($p) {
return $p->date()->toDate('%Y');
};
// function that returns the formatted month
$callbackMonth = function($q) {
return $q->date()->toDate('%B');
};
// group items using $callback
$groupedItems = collection('calendrier')
->sortBy('date', 'desc')
->group($callbackYear);
// output items by year
foreach($groupedItems as $year => $itemsPerYear): ?>
<?php
$groupedMonthItems = $itemsPerYear->group($callbackMonth);
// output items by month
foreach($groupedMonthItems as $month => $itemsPerMonth):?>
<div class="month-wrapper">
<h2><?=$month?> <?=$year?></h2>
<?php foreach($itemsPerMonth as $evenement) : ?>
<article class="item-calendrier
<?=$evenement->typeevent()->slug()?>
<?= $evenement->date()->toDate() < time() ? "passes": "a-venir" ?>"
data-mois="<?=$evenement->date()->toDate('%B')?>"
data-annee="<?=$evenement->date()->toDate('%Y')?>"
>
<header>
<div class="typeetdate">
<p class="type"><?=$evenement->typeevent()?></p>
<p class="date"><?=$evenement->date()->toDate('%d %b. %Y')?></p>
</div>
<?php if($evenement->categories()->isNotEmpty()):?>
<div class="p-tags">
<?php foreach ($evenement->categories()->split() as $type): ?>
<p><?=$type?></p>
<?php endforeach ?>
</div>
<?php endif ?>
</header>
Maybe I have to use a function to translate or format my string char ?
Can anyone help me ?
Thank’s a lot !
Have a nice december,
Zellda