Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2020-05-28 19:22:00

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,969
Website

Re: Unlimited lists

I suppose limit="unlimited" is a bit much to type? How about limit="unset", or even limit="..."?


TXP Builders – finely-crafted code, design and txp

Offline

#12 2020-05-28 19:28:56

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,331
Website

Re: Unlimited lists

Bloke wrote #323367:

Yeah, thanks. I was thinking of some magic non-numeric value for limit too. But, as you say, it’s not so obvious what they mean:

  • limit="none" could mean unlimited, or that limit should have no effect, or that there should be no articles returned.
  • limit="all" could mean unlimited, or that all limits apply (whatever that may imply).
  • limit="0" is unintuitive and could mean unlimited or return no content (which is what it currently does).
  • a new attribute like all is cleanest, but those three letters in a complicated article tag with a tonne of other attributes could be easy to miss/debug.

From looking through the discussion:

<txp:article_custom section="pageless-content" form="some-form" limit="unlimited" />
<txp:article_custom section="pageless-content" form="some-form" unlimited />
<txp:article_custom section="pageless-content" form="some-form" limitlesss />

Offline

#13 2020-05-28 20:09:55

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

Re: Unlimited lists

Ooh, limit="..." has merit. Though I do like the Easter egg too!

I’ve just looked through our code. Oleg’s right, this is a non-trivial change. Each tag handles it differently and, somewhat annoyingly, there’s not much consistency either. The purist in me says this is an opportunity to make it more consistent and therefore predictable. There’s quite a bit of redundancy in thispage pagination code, for example.

As far as I can tell, <txp:category_list> is the only tag that does it “right” insofar as:

  • limit="{integer}" (with or without offset) will use the given value.
  • limit="" or just valueless limit will use PHP_INT_MAX, which is some huge value. So, effectively unlimited.

But it does all other kinds of stuff like using the limit in exclude and to perform cacheing, which other tags don’t have.

Realistically I don’t see many people using limit without any value at the moment, so that seems like a reasonably logical way to handle it. “I’m not giving you a value, so use whatever there is”. We just have to be careful with how we handle defaults, like 10 for contenty stuff, 5 for search_results, everything for <txp:images>, and so forth.

So if we’re going to do this, it’ll need some internal refactorisation and some heavy testing to ensure we don’t make any backwards compatibility blunders. By all means continue to throw ideas here, especially if you have any insight into how we’re handling limit in each tag now, as it might spark some revolutionary idea on how we can standardise it or at least make it more sane in code. But in terms of features, this might go on the back burner.


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

#14 2020-06-07 18:47:07

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 653
Website

Re: Unlimited lists

nolimit="1", or in fact just nolimit, if present, then overriding the setting in limit, or just secretly setting limit="1000000001".

Might be foolish, as i have no understanding of the core. If so, please ignore.

Last edited by jayrope (2020-06-07 18:50:57)


a hole turned upside down is a dome, when there’s also gravity.

Offline

#15 2020-06-07 19:07:22

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

Re: Unlimited lists

jayrope wrote #323596:

nolimit="1", or in fact just nolimit

*starts humming* No no… no no, no no… no no, no no… no no there’s no limit


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

#16 2020-06-26 17:23:13

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 975
Website

Re: Unlimited lists

Not sure how helpful this is – it is just my take.

I realize that the use of the word limit can be a question (eg – is there a limit) to which we are then provide a precise answer in some way of yes or no (and the subsequent question of what is the limit?).

I think there is an argument to be made, however, that omission of limit equals unlimited and the usage of limit invokes a limit of some sort.

Therefore, to me, the intuitive solution would be it is unlimited by default (omission of limit) and a limit is only imposed when the attribute is employed. The very use of the attribute is the “yes” if you will.

Thus I can save time and coding *(be lazy :-D ) by never needing to add the attribute “limit” when unlimited is desired.

All that said, if we do need to have limited have an unlimited option, I find yes/no to be straight forward. Perhaps something like limit=“y, 100”, or limit=“n”

I freely confess though I’ve no idea how easy or hard this would be to implement, and am naive to all the various use cases.

Last edited by maverick (2020-06-26 17:24:01)

Offline

Board footer

Powered by FluxBB