Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2019-09-09 12:50:34

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,877
Website

Re: How to display images of range ids

Would it not be more logical if we just had what etc mentioned? ie <txp:images id="40, 38-40" />. My only problem is that when I see 38-40, I would expect the range to be inclusive. That is ids 38,39,40. When kids are asked to count from 1-10 for example, they are expected to include 10.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#12 2019-09-09 12:59:05

etc
Developer
Registered: 2010-11-11
Posts: 3,650
Website

Re: How to display images of range ids

colak wrote #319250:

My only problem is that when I see 38-40, I would expect the range to be inclusive. That is ids 38,39,40.

That’s fine, 38-40 means 38,39,40. But 40, 38-40 means 40,38,39 because the last 40 is removed as duplicate of the first one.

Offline

#13 2019-09-09 13:05:13

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,877
Website

Re: How to display images of range ids

etc wrote #319251:

That’s fine, 38-40 means 38,39,40. But 40, 38-40 means 40,38,39 because the last 40 is removed as duplicate of the first one.

👍


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#14 2019-09-09 13:05:27

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

Re: How to display images of range ids

etc wrote #319249:

I thought that could be a general-purpose tag, letting you (jointly with some <txp:item /> tag) split plain strings

Yeah, yeah! Me likee a lot. That allows us to split custom fields via a separator by supplying them as a tag in the items attribute. Incredibly handy, and currently only serviceable by <txp:if_custom_field> which isn’t always applicable. Sometimes you just want the field split up without testing it, which this new tag permits.

And your ‘laborious’ hack isn’t onerous at all. I like that. What does the range attribute do in your example, btw? Does that just denote the separator to be used for ranges? If so, what would this yield, assuming the range attribute defaults to hyphen:

<txp:list items="I-like-dogs. I-hate-cats." separator="." break="br" wraptag="p">
    <txp:item />!
</txp:list>

If it defaults to null or its use is intended differently, no problem.


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

#15 2019-09-10 09:13:13

etc
Developer
Registered: 2010-11-11
Posts: 3,650
Website

Re: How to display images of range ids

Bloke wrote #319253:

What does the range attribute do in your example, btw? Does that just denote the separator to be used for ranges? If so, what would this yield, assuming the range attribute defaults to hyphen:

<txp:list items="I-like-dogs. I-hate-cats." separator="." break="br" wraptag="p">...

If it defaults to null or its use is intended differently, no problem.

Yes, range is just the range separator (a better name is welcome). It would be unset by default, to avoid surprises, and separator="," as usual.

But since the main concern seems to be cf, we should probably wait until our cf branch becomes dev.

Offline

#16 2020-02-04 22:17:13

mikulas
Member
From: Czech republic
Registered: 2012-03-15
Posts: 31

Re: How to display images of range ids

Textpattern version 4.8.0 beta has support for id ranges in some tags and admin fields. So I try to display range of images using tag <txp:images /> and with ids defined in custom filed.
If both id are numbers from 1 to 9 (with separator -), all pictures in this range are displayed. However, if any digit is greater than 9, only one image is displayed.
Did I miss anything?

Offline

#17 2020-02-04 22:40:42

etc
Developer
Registered: 2010-11-11
Posts: 3,650
Website

Re: How to display images of range ids

Silly typo, sorry.

Offline

Board footer

Powered by FluxBB