Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2022-12-11 11:21:25

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

Re: latest article per author

Bloke wrote #334268:

So do we need to add a column to indicate a field is to be ‘hidden’ or ‘internal’ or something like that? Or can we use one of the existing status fields in the meta table to differentiate? Not sure we want such fields to pop up in the UI.

Absolutely, they are queries rather than raw values and must be hidden in Write UI. They would only be accessible on meta tab and have no content_id (or content_id = -1?), but I’d leave the storage implementation with you :-)

We actually already have such a virtual field in txp: score of search queries. Its value is used for sort only and is not accessible otherwise. New virtual cf computed value would be available on the public side for filtering/sorting/output like for any other cf.

Offline

#14 2022-12-12 23:22:11

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

Re: latest article per author

Bloke wrote #334269:

We’re kind of thinking that 4.9 (dev branch, as of now) will be the next version. Like, in a few weeks. Unless we can find a way to talk ourselves out of it.

You could still label 4.9 as the last MySQL5.x compatible version – and the last PHP 5.x version. Broadcast it, and then Texpattern.next (Textpattern 5.0, CF branch?) can go full speed ahead with some of those interesting goodies. And release 4.9 as scheduled in a couple of weeks.


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

Offline

#15 2022-12-28 14:52:07

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

Re: latest article per author

Finally, some SQL window functions abilities have been implemented in dev for MySQL 8+ (or similar) users:

<!-- OP question: retrieve the most recent article for each author -->
<txp:article_custom fields="*, rank[authorid](posted desc)" $posted="1" sort="AuthorID" />

<!-- Three random articles per author -->
<txp:article_custom fields="*, authorid, rank[*](*)" sort="RAND()" $rank="%%3" />

It’s not the happiest syntax ever, but, hopefully, this will be much easier in cf branch.

Offline

Board footer

Powered by FluxBB