|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
aD78 Smarty n00b
Joined: 04 Nov 2010 Posts: 2
|
Posted: Thu Nov 04, 2010 11:04 am Post subject: [Réglé] Problème affichage date |
|
|
Bonjour,
Je commence à faire des templates divers. Et j'ai un soucis que j'arrive pas a régler j'aimerais afficher toute ma date en " Majuscule " mais la commande |upper| ne fonctionne pas ou peut étre je l'ai mal mise.
Voici la ligne :
Code: | NOUS SOMMES LE {$smarty.now|upper|date_format:"%d %B"}, IL EST {$smarty.now|date_format:"%H:%M"}. |
Affichage :
Quote: | NOUS SOMMES LE 04 novembre, IL EST 12:02. |
" Novembre " ne se force pas en majuscule auriez vous un conseil pour ce problème ?
Merci d'avance,
aD`
Last edited by aD78 on Fri Nov 05, 2010 10:19 am; edited 1 time in total |
|
Back to top |
|
Gowser Smarty Pro
Joined: 19 Feb 2008 Posts: 104 Location: Nantes (France)
|
Posted: Thu Nov 04, 2010 11:19 pm Post subject: |
|
|
Bonjour / soir (il est 00h30 ^^)
Il faut juste que tu inverses le modificateur upper pour le placer après le date format
Code: |
de :
{$smarty.now|upper|date_format:"%d %B"}
vers :
{$smarty.now|date_format:"%d %B"|upper}
|
Pour rappel, les modificateurs sont interprétés de la gauche vers la droite
et qu'un $smarty.now retourne un timestamp donc un chiffre (du coup faire un upper sur un chiffre marche pas très bien )
Juste une dernière chose avec ton '%B' de ton date_format : il se base sur ta configuration de la configuration de ton serveur pour déterminer le nom du mois donc si ton serveur est en anglais, tes mois le seront aussi !
Je te conseille de changer le local de tes dates avec setlocale :
http://www.php.net/manual/fr/function.setlocale.php
++ |
|
Back to top |
|
aD78 Smarty n00b
Joined: 04 Nov 2010 Posts: 2
|
Posted: Fri Nov 05, 2010 10:09 am Post subject: |
|
|
Merci beaucoup pour l'information je vais tester ça de suite.
Edit :
Parfait
Code: | NOUS SOMMES LE {$smarty.now|date_format:"%d %B"|upper}, IL EST {$smarty.now|date_format:"%H:%M"}. |
Quote: | NOUS SOMMES LE 05 NOVEMBRE, IL EST 11:13. |
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|