Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-29 23:31:31

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

Search multiple IDs in list pages

Since TXP4.0.7 is gearing up to be The Release of Lists, would it be possible to amend one line in each of txp_list, txp_file, txp_link and txp_image such that comma-separated lists of IDs can be returned?

That is, replace this:

'id'         => "ID = '$crit_escaped'",

with:

'id'         => "ID IN (" .join(",", doArray(do_list($crit_escaped), 'doQuote')). ")",

so that other pages could call the 4 list pages to show particular items? Or, of course, so people could type more than one ID in the search box if they wished.

Last edited by Bloke (2008-06-29 23:34:07)


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

#2 2008-07-18 12:29:01

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

Re: Search multiple IDs in list pages

Just remembered this thread and noticed the code is a bit wordy, sorry. To save a function call:

'id'         => "ID IN (" .doQuote(join("','", do_list($crit_escaped))). ")",

or even leaner still:

'id'         => "ID IN ('" .join("','", do_list($crit_escaped)). "')",

?

If 4.0.7 is in lockdown or this impacts other stuff I’ve not thought of, or something like this is not likely to make it into the core at any point in future, would you please let me know so I can try to find some other way of listing specific items in the list pages from my plugin.

Many thanks in advance.


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

#3 2008-07-18 15:45:05

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Search multiple IDs in list pages

Offline

#4 2008-07-19 08:53:47

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

Re: Search multiple IDs in list pages

Game on! Thank you very much, kind sir.


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

Board footer

Powered by FluxBB