Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
time is not parsed
Hi all,
I just noticed that for some strange reason, the time stamp is no longer parsed in my site
I used to have
<txp:article_custom section="projects,texts,blog,about" sort="LastMod desc" limit="1" form="">
<txp:modified format="%d %B %G at %r" />.
</txp:article_custom>
which was working just fine but at some point it stopped.
I now replaced it with
<txp:article_custom section="projects,texts,blog,about" sort="LastMod desc" limit="1" form="">
<txp:modified format="%d %B %G at %I:%M:%S %p" />.
</txp:article_custom>
but it still does not work.
Edited to add that the problem also makes the sitemap fail the validation: github.com/colak/neme/blob/master/pages/sitemap.tpl#L35 and I have temporarily deleted the time elements from it until we work out what’s wrong.
Any suggestions on how I could troubleshoot this one?
txp: v4.8.8
php: v7.4.25
Last edited by colak (2022-04-08 07:28:52)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: time is not parsed
Hi Yiannis,
it’s the effect of some changes in txp 4.8.8 due to strftime()
deprecation in php 8.1. Try
<txp:modified format="%d %B %G 'at' %I:%M:%S %p" />
Offline
Re: time is not parsed
Thanks so much Oleg. That’s fixed it.
Any ideas on how the sitemap could be fixed?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: time is not parsed
colak wrote #333053:
Thanks so much Oleg. That’s fixed it.
Any ideas on how the sitemap could be fixed?
I think you just need to escape the T and Z with a backslash so that they’re not processed:
<txp:modified format="%Y-%m-%d\T%H:%M:%S\Z" />
(Just tried it on the demo and it produced the correct output.)
TXP Builders – finely-crafted code, design and txp
Offline
Re: time is not parsed
Thanks so much Julian. I think that the backslashes did it.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: time is not parsed
You can also try format="w3c"
which seems to be the default for sitemaps.
Offline
Re: time is not parsed
etc wrote #333057:
You can also try
format="w3c"
which seems to be the default for sitemaps.
That indeed does work and it’s so much simpler!
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: time is not parsed
etc wrote #333057:
You can also try
format="w3c"
which seems to be the default for sitemaps.
Oh, that is nice clear way of formatting the date – for things like sitemaps or inside the <time itemprop="dateModified" datetime="<txp:modified format='w3c' />">
. It took me while to find some documentation (PHP docs).
Thank you for that hint.
Last edited by phiw13 (2022-04-09 08:06:48)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Pages: 1