Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2019-12-19 11:29:49

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,076
Website

Re: Link to last published article

Bloke wrote #320605:

Oleg beat me to this, but it’s documented. The example could be clearer, or we could add some more, maybe even this tip itself. Values are auto-sanitized when pulling query parameters in from the URL.

That attribute, type, is documented, but that particular value – latest – is not. That is what created my confusion and why I raised the question. Unless, – and then I didn’t understand it at all, that is covered by q (query string). Perhaps a better example, or some more clarification would be nice. Tia.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#14 2019-12-19 11:42:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Link to last published article

I’ve added this example and made a few tweaks to the page_url tag page for clarification. That okay or does it need more explanation?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#15 2019-12-19 12:02:51

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,076
Website

Re: Link to last published article

The example and the comment that follows do make things clearer, yes thank you for that.

Thinking about it, I suspect lots of my initial confusion comes from the word latest which is something quite specific in the date / time space. I saw it as a specific keyword that was not listed in the possible values, whereas it is, in the example above, just a random string.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#16 2019-12-19 12:11:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Link to last published article

phiw13 wrote #320609:

I suspect lots of my initial confusion comes from the word latest which is something quite specific in the date / time space. I saw it as a specific keyword that was not listed in the possible values, whereas it is, in the example above, just a random string.

True. If you can think of a better adjective for use in the example, I’ll amend it.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#17 2019-12-19 12:23:35

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,076
Website

Re: Link to last published article

Bloke wrote #320610:

True. If you can think of a better adjective for use in the example, I’ll amend it.

Let me sleep over it, I’ll try to think something. It is late now.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#18 2019-12-19 14:42:55

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Link to last published article

Bloke wrote #320605:

And, yes, from 4.8.0 jakob is right that <txp:article_custom> will be able to read in URL variables directly so you can do crazy filtering via custom field values or whatever. A boon for sites that offer browsing via article CFs (e.g. an estate agency site that reveals front-end select lists for number of rooms, location, property type, etc). Just add those params to the query payload and you can pass them straight through to <txp:article_custom>.

You can even alias them via match="cf_name=url_name" attribute, for extra flexibility.

Offline

#19 2019-12-19 14:57:24

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Link to last published article

gilibaus wrote #320575:

I publish a new article every week and all of them belong to the same section. I need a single URL that always points to the last published individual article in that section. Any hint? Thanks.

A bit more 4.7-ish: in Advanced options create a html custom form type with mediatype="text/html". Then create a latest form of html type:

<txp:article limit="1">
    <txp:header name="Location" value='<txp:permlink />' />
</txp:article>

Now each hit of /section/?f=latest URL should 302-redirect you to the latest article.

Offline

#20 2019-12-19 22:09:48

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,076
Website

Re: Link to last published article

Bloke wrote #320610:

True. If you can think of a better adjective for use in the example, I’ll amend it.

How about “most-recent” ? More string like while still saying latest, and for an international audience still has an easy reference point.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#21 2019-12-20 18:55:06

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: Link to last published article

phiw13 wrote #320617:

How about “most-recent” ? More string like while still saying latest, and for an international audience still has an easy reference point.

oldest / newest ?


…. texted postive

Offline

#22 2019-12-20 22:04:13

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Link to last published article

I’ve updated the example to use ‘most-recent’ and added Oleg’s example for completeness. Not sure it’s quite the right place for it in the tag doc, as it’s really showing off a shortcode, but we can move it if necessary when we decide what to do with the shortcodes doc.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB