Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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
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
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
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
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
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
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
Online
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