Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
What is the best way to find the previous and next values in a list?
My article_image field contains this list of image ids: 245,239,246,238,237,251,243,241,244,236,242,250,247,240,248,249
Given one of the ids in the list, what is the easiest way to figure out the previous and next ids?
For instance, how can I return that 241 is previous and 236 is next for image id 244?
I’ve been trying to wrap my head around it with variables and txp:images and have entertained the thought of somehow using smd_each, but I am really stumped and my brain is stuck. In this particular case, tpx:images with txp:newer and txp:older will not work because I am calling the image id via a custom url variable.
I’m posting this as a new topic here, but it is also in reference to this thread
Last edited by photonomad (2012-01-17 17:18:10)
Offline
Re: What is the best way to find the previous and next values in a list?
I see we’re thinking along the same lines. See that thread for an idea along these lines.
TXP Builders – finely-crafted code, design and txp
Offline