Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2019-12-19 09:48:02

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,139
Website

Re: Link to last published article

etc wrote #320603:

It was in 4.7 and I have even documented it. RTFM, comrades ;-)

I read it before posting! I didn’t see that particular type value mentioned, that is what puzzled me.

Anyway, thanks for the explanation. Jacob, if you find back that post I’ll be happy to read it.


Where is that emoji for a solar powered submarine when you need it ?

Offline

#12 2019-12-19 10:20:26

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,775
Website

Re: Link to last published article

phiw13 wrote #320600:

is that an undocumented value for the type attribute here?

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.

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>.


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

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

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,139
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 ?

Offline

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,775
Website

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: 2,139
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 ?

Offline

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,775
Website

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: 2,139
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 ?

Offline

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

etc
Developer
Registered: 2010-11-11
Posts: 3,934
Website

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: 3,934
Website

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: 2,139
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 ?

Offline

Board footer

Powered by FluxBB