Closed (fixed)
Project:
Zen
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
28 Aug 2007 at 16:05 UTC
Updated:
26 Dec 2007 at 18:41 UTC
Jump to comment: Most recent file
In the Zen theme the date and time tags above each posting ignore the date and time format settings and show in an archaic date format. Worse, the important time is missing altogether.
Probably very easy to fix, so please ...
Example: http://winhlp.com/
Hans-Georg
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | removed_datetime.patch | 1.79 KB | johnalbin |
Comments
Comment #1
chadchandler commentedTry going into your admin>>config>>date & time and changing the "short" "medium" long" formats.
Comment #2
zirafa commentedThat's because the node.tpl.php file has a custom date format string. It doesn't use the default drupal date string formatting, you can easily change this by having print $submitted instead or reading up on format_date.
Comment #3
hgmichna commentedThanks for your assistance! It doesn't work for me yet, but we're probably close. I did this:
But it has no effect. I took the line from another theme (Garland), where the time appears. Is there any other place in the PHP code where this may be done? I'm not a PHP programmer and don't understand the entire Drupal anyway.
Let us not forget that it is still a slight bug: the time is missing. Even if you can help me solve it, everybody else using Zen is still missing the time.
Hans-Georg
Comment #4
hgmichna commentedEmbarrassing when one tries to modify PHP stuff without knowing how to do it. Second, this time successful, try was this in comment.tpl.php:
And this works perfectly for comments. The similar code for nodes (after swapping /* */ for
) does not work. Probably a stupid error on my side. I'll see if I can find it. Sorry for my PHP-clumsiness.
Still fixing the missing time for me doesn't mean fixing it for everyone, and so I think this bug report should stay active.
Hans-Georg
Comment #5
hgmichna commentedGot it. Sorry again for the confusion. Zen, unlike Garland, has an additional file named node-forum.tpl.php, which needed to be modified as well.
Thanks again for the good hint!
Nonetheless I'll keep recommending to change this in the next release.
Hans-Georg
Comment #6
zirafa commentedYou may want to familiarize yourself with PHP date formatting settings, which will basically convert a timestamp to whatever date formatting you want. In Zen's case, it was a conscious choice not to print the time to show that the date can be customized.
PHP's Date Function
In Drupal we have a special format_date function that lets you print out long, short, medium forms or custom formatting (Zen uses custom formatting). When you use custom formatting, you can refer to the above PHP date link for how to customize the date formatting.
Drupal's format_date
Hope this helps.
Farsheed
Comment #7
hgmichna commentedThank you for the good links and information! Very interesting, and it solves the problem for me.
Let me propose anyway to change the custom format for the next release such that it contains the time. It can still be a deviating custom format if that is preferred, but take into consideration that most Drupal administrators are not PHP programmers and are unable to change the date-time format. I could do it only because I happen to be a software developer (though unfortunately without knowlege of PHP).
Hans-Georg
Comment #8
johnalbinI think that most people have their own preferred date/time display settings. And hard-coding one format into the .tpl.php files will inevitably displease some people no matter what is picked. Even picking one of the standard date formats, small", "medium" or "large," doesn’t allow enough customization.
Editing the code in node.tpl.php and node-forum.tpl.php is the only short-term solution.
But, the best route is to allow people to easily customize their date format via a form. i.e. Theme Settings API integration.
Comment #9
kdebaas commentedOn a related note, the language specific 'Posted by' strings, and the non-localized formatting of the date should probably not be hardcoded into the .tpl.php files either.
Comment #10
hgmichna commentedWhy not let the admin enter a date and time format string? That's probably much better than giving him the choice of three preprogrammed formats. It's also extremely easy to program, actually a simplification. May go into the Drupal core though.
Hans-Georg
Comment #11
johnalbinThe "Posted by" string is a part of Drupal core. It’s not handled by Zen.
Also, how would one make the formatting of the date localized? It seems for each language, one would need to set the PHP formatting string and not just translate the string for the month name; that’s not something that is currently handled by the locale or i18n modules, is it?
Comment #12
kdebaas commentedI beg to differ. The 'Posted by' string can be found in the template.php file in the zen theme folder, on line 235.
Also, when using the format_date function with one of the configured formats of Drupal (such as 'small', 'medium', 'large'), instead of a custom php format string, the date seems to adapt to the interface language. This is true, for example, in Garland, which displays the date in the language of your Drupal install. And now also in my Zen subtheme, after adapting the main zen template.php.
Comment #13
johnalbinOh. There it is! :-)
Ok. I would agree with you then, Klaas. The base theme shouldn't be messing with the date/time formatting. That should be left to the sub-theme.
I'll remove that from template.php and from comment.tpl.php if there are no objections. These bits of code should be moved to some HOWTO documentation on customizing the date/time.
Everyone agree?
Comment #14
johnalbinComment #15
kdebaas commentedSeems good to go. Unfortunately I can't actually test the patch until next week.
Comment #16
kdebaas commentedActually, I found some time this morning to review the patch:
I reverted my template.php file to its original state and applied the patch to template.php and comment.tpl.php.
I can confirm that the date and author of the posts in my Zen subtheme are now correctly displayed in the language I set for my Drupal install.
Comment #17
johnalbinFixed in 5.x-1.x-dev.
Comment #18
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.