1
This is just a desire to learn, I put into production a site that had been working for some time. and I noticed that utf8_encode worked on the localhost but does not work in production now. I implemented htmlentities and the result was reversed, in localhost the date is gone and in the net is perfect. Someone can explain to me why?
On the left is on the remote server and on the right is on the local: Although the script used is the same.
so it looks bandstand on the net:
<div id="news">
<?php foreach ($articles as $article) { ?>
<div><h2><?php echo $article['article_title']; ?></h2><br><span id="date">Publicado
<?php
setlocale(LC_ALL, 'pt_BR.utf8', 'Portuguese_Brazil');
//setlocale(LC_ALL, NULL);
date_default_timezone_set('Europe/Lisbon');
$uppercaseMonth = ucfirst(gmstrftime('%B'));
echo htmlentities(strftime( '%a, '.$uppercaseMonth.' %d de %Y'/* - %H:%M'*/, $article['article_timestamp']));
?></span><p><?php echo $article['article_content']; ?><br><br><span id="print"><a onclick="javascript:window.print();" href="#">Imprimir</a></span><span id="link"><a href="#">Enviar link</a></p></div>
<?php } ?>
</div>
so it’s right on the spot:
<div id="news">
<?php foreach ($articles as $article) { ?>
<div><h2><?php echo $article['article_title']; ?></h2><br><span id="date">Publicado
<?php
setlocale(LC_ALL, 'pt_BR.utf8', 'Portuguese_Brazil');
//setlocale(LC_ALL, NULL);
date_default_timezone_set('Europe/Lisbon');
$uppercaseMonth = ucfirst(gmstrftime('%B'));
echo utf8_encode(strftime( '%a, '.$uppercaseMonth.' %d de %Y'/* - %H:%M'*/, $article['article_timestamp']));
?></span><p><?php echo $article['article_content']; ?><br><br><span id="print"><a onclick="javascript:window.print();" href="#">Imprimir</a></span><span id="link"><a href="#">Enviar link</a></p></div>
<?php } ?>
</div>
put the code snippet so it’s better to give you a feedback
– Bruno Rozendo
That’s it, just change the echo line to the date.Obgado
– Miguel