Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2010-12-31 13:08:28
- aeris
- Member
- Registered: 2009-03-01
- Posts: 12
show "last updated" date
Can I display the date of the first article somewhere outside of it? Eg. in the sidebar: “this site was last updated x days ago”.
mrz_lastsite_mod is gone, tcm_lastupdate doesn’t support PHP time format and shows a date over one year ago when the latest article was posted a couple of days ago. Experimenting with txp:article and article_custom with pgonly=“1” just produced some odd results :)
Offline
#2 2010-12-31 13:12:49
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: show "last updated" date
I’m using this:
<txp:php>
global $prefs;
$format = '%d-%m-%Y'; // CHANGE THIS TO FIT YOUR NEEDS
echo safe_strftime($format, safe_strtotime($prefs['lastmod']));
</txp:php>
If it’s just the most recent article’s date you want to display:
<txp:article_custom limit="1">
<txp:posted />
</txp:article_custom>
Last edited by els (2010-12-31 13:14:13)
Offline
Re: show "last updated" date
I’m still using ob1_modified. Long an orphan, but still available and still works. With the plugin you could adapt Els’s code:
<txp:article_custom limit="1">
<txp:ob1_modified />
</txp:article_custom>
Code is topiary
Offline
Re: show "last updated" date
jsoo wrote:
I’m still using ob1_modified. Long an orphan, but still available and still works. With the plugin you could adapt Els’s code:
TXP v4.0.7 introduced <txp:modified />.
Offline
Re: show "last updated" date
OK, so I’m a little behind the times.
<txp:article_custom limit="1">
<txp:modified />
</txp:article_custom>
Edit: Now I remember why I am still using ob1_modified on one site: it has an option to only output the modified date if it differs from the posted date.
Last edited by jsoo (2010-12-31 15:55:36)
Code is topiary
Offline
#6 2010-12-31 18:10:36
- aeris
- Member
- Registered: 2009-03-01
- Posts: 12
Re: show "last updated" date
Els wrote:
If it’s just the most recent article’s date you want to display:
<txp:article_custom limit="1">
<txp:posted />
</txp:article_custom>
Thank you! That did the job. Can’t believe it was that simple…
Last edited by aeris (2010-12-31 18:12:38)
Offline
Pages: 1