Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2004-07-26 01:31:11
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
[plugin] [ORPHAN] zem_posted
Similar to <txp:posted />
, with the addition of time zone and format support. The time offset and format specified in the Textpattern configuration are ignored. Examples:
<txp:zem_posted />
– Show the article timestamp in the server’s default format and time zone<txp:zem_posted tz="GMT+4:00" format="%H:%M:%S %x" />
– Show the timestamp converted to GMT4 hours, with the specified format. Note – on most Unix systems, the +/is reversed: use “+1” if your time zone is GMT minus 1hr, “-1” if you’re in GMT plus 1hr. See here for an explanation of the format.<txp:zem_posted tz="Australia/Sydney" />
– Show the article timestamp using Sydney’s timezone, including daylight savings as appropriate. The recognised zone names are system dependent – check the contents of /usr/share/zoneinfo, /usr/share/lib/zoneinfo or similar for details.<txp:zem_posted format="%H:%M" archiveformat="%X %x" />
– Use “%H:%M” as the front page date format, and “%X %x” as the archive date format.
download:
http://vigilant.tv/documents/tp/zem_posted-0.1.txt
(PS: am I duplicating an existing plugin here? I find it hard to believe no one has done this yet)
Last edited by zem (2004-07-27 23:03:28)
Alex
Offline
Re: [plugin] [ORPHAN] zem_posted
well I created fundates a while ago, but this is somewhat different. (mine just is a passthrough to the php date command, with some automatic escaping to help newbies).
I agree, we really do need a central plugin database somewhere…
Offline
Re: [plugin] [ORPHAN] zem_posted
This is the only Central Plugin List that I know of. But it’s not exactly comprehensive.
TextPattern user since 04/04/04
Offline
Re: [plugin] [ORPHAN] zem_posted
I like the zem_posted plugin. However I am curious if it would be possible to get it working within an article. I would like to have the headline and then the date / time of the article (i.e. when it was posted).
Maybe someone could come up with a plugin like that … would be more than nice to have.
Regards,
Nils
Offline
Re: [plugin] [ORPHAN] zem_posted
? I don’t understand the difference. Mine, and I think, his, works in the article form…
Offline
Re: [plugin] [ORPHAN] zem_posted
Actually, when I use it inside an article, I get a date that seems to be the current servertime at GMT. But if I put it after the article, it will render correctly.
Could it be because I use international date + time in the admin-interface?
Any hints?
Offline
Re: [plugin] [ORPHAN] zem_posted
Okay, now I have spent several hours on analyzing the whole thing. My current server time is 26.07.2004, 23:04h (Germany) and the time I get when I call the plugin-function
<pre><code><txp:zem_posted format=”%d.%m.%Y, %H:%M” /></code></pre>
returns 26.07.2004, 21:04h —- there is already a 2h difference and even if I set it to GMT +1:00, which would be the correct time-zone, it goes even more into the wrong direction.
But moreover the time it SHOULD display is 19.03.2004, 19:29h —- which is the date that has been assigned to the article. And just to make sure that the date is set absolutely correct I did it by hand with phpMyAdmin.
I call the plugin-function from with a form. And the form is accessed from within an article by calling the form-function.
This is really frustrating. I am considering to hardcode it again (as so many times before with TXP, but it still remains a cool tool).
Regards
Nils
Offline
#8 2004-07-26 22:53:30
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_posted
Nils,
There could be any number of things going on here. Try placing both of these tags in your article form:
<code>
<txp:zem_posted tz=“GMT” format=”%d.%m.%Y, %H:%M %Z” />
<txp:zem_posted tz=“GMT+1:00” format=”%d.%m.%Y, %H:%M %Z” />
</code>
That will tell you the article timestamp in GMT, and (hopefully) GMT + 1h, and confirm that the timezones are working correctly for both. If you can post the results of that I’ll have a better chance of working out what’s going on.
Last edited by zem (2004-07-27 00:00:26)
Alex
Offline
Re: [plugin] [ORPHAN] zem_posted
zem,
thanks for your post. This is the result. Topmost is the time I get, when I use the default zem_posted without timezone:
<pre><code>
NoGMT: 27.07.2004, 19:17:15
GMT: 27.07.2004, 19:17 GMT
GMT+1:00: 27.07.2004, 18:17 GMT
</code</pre>
Ah … forgot to mention that the server time is 27.07.2004, 21:17 and my timezone is Berlin which would be GMT+1:00 so that GMT+1:00 is the wrong time.
Hope that helps. I have disabled this feature until I know any better.
Regards,
Nils
Last edited by nils73 (2004-07-27 19:32:30)
Offline
#10 2004-07-27 22:56:17
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_posted
Ah. Sorry, my mistake – I misinterpreted the tzset man page when writing the documentation.
It seems that to specify a time zone of GMT plus 1hr, you need to set it as “GMT-1”. For GMT minus 1hr, it’s “GMT+1”. (For some reason, Unix wants you to specify the offset from your time zone to GMT, not the other way around).
Another method would be to try tz=“Europe/Berlin”. If your system recognises that, it should automatically handle daylight savings.
Alex
Offline
Re: [plugin] [ORPHAN] zem_posted
Anyhow … it did not solve the main problem. I just get back the current date, but not the creation date of the article. Sad but true.
If I put the output-article-tag somewhere beneath the footer of my website, it will work. But not inside the article.
Offline
#12 2004-07-29 22:48:26
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_posted
Strange. It works fine for me inside an article. Does this happen on all articles? Does txp:posted show the correct date?
Has anyone else seen the same problem?
Alex
Offline