Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
strtotime instead of strftime function
#1
hello
After investigating JP's problem described in this thread http://get-simple.info/forum/topic/1074/...t-correct/
I wonder why GS utilizes strtotime, instead of strftime function + eventually iconv function (for UTF-8 encoding), as it is capable to show date only in US English format.

There's no problem if somebody wants to show date using digits, but localized textual representation of days, and months will be shown only in english.

I know that my solution isn't perfect, and strftime should use a declared variable (maybe even being able to be set in admin panel). But I'm almost falling asleep on my keyboard, and just wanted to let you know about that.
My solution is working, although not all steps mentioned are needed to succeed .
Addons: blue business theme, Online Visitors, Notepad
Reply
#2
Could anyone confirm if this problem still occur or has been fixed in latest 2.03/2.04 build ?
Addons: blue business theme, Online Visitors, Notepad
Reply
#3
i dont think it has... submit a patch if you can, and we will look into what it will take to get it in... Thanks!
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#4
I'm messing with 2.04, and I see an additional bug.
Look at the attached image. I use polish language file, but I still see on the sites "permalink", ant "last saved" phrases words, even when LAST_SAVED variable (line 87) is translated to polish language. There's no var to translate "permalink" thou.

About main problem with date, variables inside translation file
"DATE_FORMAT" => "j.m.Y", //please keep short
"DATE_AND_TIME_FORMAT" => "j.m.Y - G:i", //date and time
are used only in admin panel, to show page creation/save date, and aren't used to show date of last page save.

I posted a way how to set own date format in first post of this thread.
Basically there's only 1 thing to change inside theme_functions.php file.
$myVar = date($i, strtotime($date)); -> $myVar = iconv("", "UTF-8",strftime('%A, %e.%B. %Y'));
(in earlier versions of GS the date was echo'ed, now it's attached to $myvar)

This is more a temporary fix, as the date format should be loaded from translation file, not hardcoded in .php file, because in different countries date is displayed in their own format.
In Poland it's day.month.year, while in for example US its month-day-year (afair).
It works for me, but other users, who would like to display the date on pages in their own taste, have to edit core files.
I'm afraid I can't provide a better solution using a dedicated variable in language file, due to my poor php knowledge Sad
Addons: blue business theme, Online Visitors, Notepad
Reply




Users browsing this thread: 1 Guest(s)