Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-06-24 06:29:21

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

Author landing pages and txp:recent_articles

More a question of “Why doesn’t it work?”

In my default template I have:

<txp:if_author>
<txp:article_custom section="bio-pages" author='<txp:author title="0" />' limit="1" form="bio-form" pgonly="0" />
<txp:recent_articles label="Recent articles by this author" labeltag="h3" limit="5" break="li" wraptag="ul" section="this,that,those" />
<txp:else />
<!-- and much more -->
</txp:if_author>

That pulls the bio article about the author, just fine, no problems here.
However, I expected the <txp:recent_articles /> to output a list of recent articles by the author. That turned out to be a false expectation, in the sense that it pulled a list of all recent articles, by any author. I tried putting the <txp:recent_articles /> inside the bio-form used by <txp:article_custom />, but with the same results.

So the question: is <txp:recent_articles /> global then, and not sensitive to the author context?

For the record – I solved this by building the recent articles list slightly more manually:

<h3>Recent Articles by this author</h3>
<txp:article limit="5" listform="author_article_list" sort="Posted desc" status="4" />

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

Offline

#2 2015-06-24 09:05:41

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Author landing pages and txp:recent_articles

Why don’t you use txp:article instead of txp:recent_articles? The most recent articles will be displayed first with the default sorting.

Edit: oh, ok, you solved it. Maybe you could edit your topic title…

Last edited by NicolasGraph (2015-06-24 09:07:52)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#3 2015-06-24 09:10:22

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

Re: Author landing pages and txp:recent_articles

NicolasGraph wrote #291930:

Edit: oh, ok, you solved it. Maybe you could edit your topic title…

The question in my post is (quoting myself):

So the question: is <txp:recent_articles /> global then, and not sensitive to the author context?


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

Offline

#4 2015-06-24 09:18:17

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

Re: Author landing pages and txp:recent_articles

phiw13 wrote #291921:

is <txp:recent_articles /> global then

The tag is pretty lame in most regards actually. It’s not cognisant of any context unless you explicitly tell it what to think via its category or section attributes.

We should change that by offering an author attribute so you can set the context, and upgrade it to pick up the current context by default. I’ll look into that, thanks for bringing it up. Throw rocks if you haven’t heard anything about it in a suitable time frame.


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

Online

#5 2015-06-24 09:21:35

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Author landing pages and txp:recent_articles

In reply to phiw13 #291931:

So the question: is <txp:recent_articles /> global then, and not sensitive to the author context?

Ok, sorry. There are other topics where you can find the answer. Look at this post:

Mary wrote #153513:

The tag doesn’t check for context, it just makes a list (like how article_custom works), so it’s not a bug per se.

Edit: Stef is too fast…

Last edited by NicolasGraph (2015-06-24 09:48:20)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#6 2015-06-24 09:21:43

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

Re: Author landing pages and txp:recent_articles

Bloke wrote #291933:

We should change that by offering an author attribute so you can set the context, and upgrade it to pick up the current context by default. I’ll look into that, thanks for bringing it up. Throw rocks if you haven’t heard anything about it in a suitable time frame.

Sounds cool. Want me to open an issue on Github?


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

Offline

#7 2015-06-24 09:27:55

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Author landing pages and txp:recent_articles

recent_articles is in fact not sensitive to the author context, the code in the tag function never looks for it.

Offline

#8 2015-06-24 09:34:54

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

Re: Author landing pages and txp:recent_articles

phiw13 wrote #291935:

Sounds cool. Want me to open an issue on Github?

Actually, yes please, that’d keep it on our radar. Thanks.


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

Online

#9 2015-06-24 09:39:06

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Author landing pages and txp:recent_articles

What txp:recent_articles does that we can’t do with article or article_custom? Because using txp:recent_articles with an author attribute in a txp:if_author context is useless as txp:article works…

Last edited by NicolasGraph (2015-06-24 09:39:58)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#10 2015-06-24 09:41:57

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

Re: Author landing pages and txp:recent_articles

NicolasGraph wrote #291939:

What txp:recent_articles does that we can’t do with article or article_custom? Because using txp:recent_articles with an author attribute in a txp:if_author context is useless as txp:article works…

That is quite true. Maybe the tag has actually had its day and we deprecate it, keep it as a stub that calls <txp:article_custom /> under the hood and then ultimately remove it.

EDIT: Just looked at the code for it. No attributes there that are anything special, as you say. It’s just a poor-man’s <txp:article_custom>. And like article_custom, you can’t paginate it (not that you’d probably need to). Perhaps that’s the real reason for keeping the tag around, since having two <txp:article> tags on the page would potentially break pagination. From that angle it’s kind of useful. Sort of.

EDIT 2: So the question comes down to whether having a non-paging, context-aware tag for displaying articles is useful. Like a halfway tag between the fully context-aware and fully pageable <txp:article />, and the wholly not pageable (without a plugin) and completely uncontext-aware <txp:article_custom>.

Last edited by Bloke (2015-06-24 09:53:24)


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

Online

#11 2015-06-24 09:49:40

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Author landing pages and txp:recent_articles

Bloke wrote #291940:

That is quite true. Maybe the tag has actually had its day and we deprecate it, keep it as a stub that calls <txp:article_custom /> under the hood and then ultimately remove it.

Never used it. I would vote to deprecate it.

Edit: Maybe we should open a topic as you did for the form preview.

Last edited by NicolasGraph (2015-06-24 10:40:36)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#12 2015-06-24 11:47:21

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

Re: Author landing pages and txp:recent_articles

Bloke wrote #291940:

EDIT: Just looked at the code for it. No attributes there that are anything special, as you say. It’s just a poor-man’s <txp:article_custom>. And like article_custom, you can’t paginate it (not that you’d probably need to). Perhaps that’s the real reason for keeping the tag around, since having two <txp:article> tags on the page would potentially break pagination. From that angle it’s kind of useful. Sort of.

That is the situation I’ve used it in other context: a <txp:article>followed by <txp:recent_articles> (specifically related articles in a category). Not that there was any pagination planned in this.

EDIT 2: So the question comes down to whether having a non-paging, context-aware tag for displaying articles is useful. Like a halfway tag between the fully context-aware and fully pageable <txp:article />, and the wholly not pageable (without a plugin) and completely uncontext-aware <txp:article_custom>.

Perhaps improving one the limits imposed by pagination with <txp:article />? Spending cycles on improving both <txp:article /> and <txp:article_custom> seem like a better use of developer time (after fixing / working on the multiple other things that need attention on 4.6).


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

Offline

Board footer

Powered by FluxBB