Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

[Réglé] Problème affichage date

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French
View previous topic :: View next topic  
Author Message
aD78
Smarty n00b


Joined: 04 Nov 2010
Posts: 2

PostPosted: Thu Nov 04, 2010 11:04 am    Post subject: [Réglé] Problème affichage date Reply with quote

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
View user's profile Send private message
Gowser
Smarty Pro


Joined: 19 Feb 2008
Posts: 104
Location: Nantes (France)

PostPosted: Thu Nov 04, 2010 11:19 pm    Post subject: Reply with quote

Bonjour / soir Smile (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 Smile
et qu'un $smarty.now retourne un timestamp donc un chiffre (du coup faire un upper sur un chiffre marche pas très bien Razz )

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
View user's profile Send private message Send e-mail
aD78
Smarty n00b


Joined: 04 Nov 2010
Posts: 2

PostPosted: Fri Nov 05, 2010 10:09 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP