Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-11-04 16:57:50

ingleslenobel
Member
Registered: 2014-10-16
Posts: 88

if published?

Hello,

I was wondering if there is such a thing as an ‘if published’ tag/plugin extra that I could tap into. I’m after something that will update a 3rd party database table with a timestamp value for ‘when published’, so I can display it on a homepage widget which shows page created and updated [but on flatfile pages through php getlastmod()]

Thanks!

Offline

#2 2014-11-04 17:11:43

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: if published?

I am thinking that wet_if_status: Conditional tags checking for live or sticky may be what you are seeking.

Offline

#3 2014-11-04 17:15:13

ingleslenobel
Member
Registered: 2014-10-16
Posts: 88

Re: if published?

Ahhhhh, superb, looks just the job, thank you sir!

Offline

#4 2014-11-04 22:10:21

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,921
Website GitHub

Re: if published?

And if you want the Lastmod timestamp for the entire site, which is updated whenever any new content is added to txp, you should be able to get at it with this:

<txp:php>global $prefs; echo $prefs['lastmod'];</txp:php>

Another approach might be to use the rss file and bring that into your other site. The lastmod for the whole site is at the top of your rss file (http://extreme-macro.co.uk/extremist/rss)

<pubDate>Sun, 02 Nov 2014 22:08:43 GMT</pubDate>

and then the most recent articles follow. There are php scripts out there that will bring in your rss xml file, so that you can include the most recent posts e.g. in the sidebar of your other site. That rss feed includes title, link, pubdate and more, so you can build a nice little overview of recent blog articles just from the feed, which txp updates automatically every time you post a new article.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2014-11-05 17:31:50

ingleslenobel
Member
Registered: 2014-10-16
Posts: 88

Re: if published?

Thanks, jakob! I’m making great progress – is there some array in an article I can to get txp:posted out as a timestamp?

Offline

#6 2014-11-05 17:37:22

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: if published?

You can format the posted date as you like, see “format”.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#7 2014-11-05 17:48:09

ingleslenobel
Member
Registered: 2014-10-16
Posts: 88

Re: if published?

Ahhh danke, didn’t spot %s in there the first time. slap forehead

Offline

Board footer

Powered by FluxBB