Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2025-08-09 04:11:22

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,222
Website GitHub Mastodon Twitter

Re: Make the exclude attribute global

phiw13 wrote #340092:

Yes, but that builds a list of image categories, not a list of images

The point in this thread is adding the exclude attribute to more tags (in this case <txp:images />.

I do agree with you that using exclude would be simpler

There are various ways todo now what I suggested with category, one of which could be using categrory list in a variable.

Someting like this

<txp:variable name="img_cats">
<txp:category_list label="" type="image" exclude="my-category" wraptag="" break=",">
<txp:category />
</txp:category_list>
</txp:variable>

<txp:images category='<txp:variable name="img_cats" />' />

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#14 2025-08-09 08:23:08

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

Re: Make the exclude attribute global

Done, please test. It does not handle size attribute atm, but this can be added if necessary.

I’m not quite happy with leading dots in extension=".jpg, .png". Should we allow also dotless extension="jpg, png" syntax, for readability?

Offline

#15 2025-08-09 08:37:41

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

Re: Make the exclude attribute global

etc wrote #340095:

Done.

Woohoo. Thank you. Will play.

I’m not quite happy with leading dots in extension=".jpg, .png". Should we allow also dotless extension="jpg, png" syntax, for readability?

The extension dots in the field sometimes really annoy me and I’ve been caught out time and again with them. So if there’s a way to softly allow either syntax, that would be a boon.


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 2025-08-09 09:11:55

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,427
Website

Re: Make the exclude attribute global

etc wrote #340095:

Done, please test. It does not handle size attribute atm, but this can be added if necessary.

Nice! I’ll try to play with it tomorrow or so.

I’m not quite happy with leading dots in extension=".jpg, .png". Should we allow also dotless extension="jpg, png" syntax, for readability?

If that can be done, here are 10+ votes for dotless syntax, it reads just a more easily.


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

Offline

#17 Today 08:38:08

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,427
Website

Re: Make the exclude attribute global

This seem sto work quite well in my basic tests – exclude="'<txp:custom_field name="article_image"/>" and exclude="category-name". Thank you for that.

etc wrote #340095:

I’m not quite happy with leading dots in extension=".jpg, .png". Should we allow also dotless extension="jpg, png" syntax, for readability?

I see you’ve now implemented the dotless syntax for extension. That is great (but untested yet). Also implemented if I understand the code is exclusion based on size. How does that work exactly?


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

Offline

#18 Today 10:46:53

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

Re: Make the exclude attribute global

phiw13 wrote #340121:

This seem sto work quite well in my basic tests – exclude='<txp:custom_field name="article_image" />' and exclude="category-name".

Only numeric image ids can be excluded directly, so exclude="1,2,3" or exclude='<txp:custom_field name="article_image"/>' is ok. But exclude="category-name" should not work at all, you must combine two attributes: category="category-name" exclude="category".

I see you’ve now implemented the dotless syntax for extension. That is great (but untested yet). Also implemented if I understand the code is exclusion based on size. How does that work exactly?

Exactly like categories, and you can mix multiple filters:

<txp:images category="category-name" extension="webp" size="portrait" exclude="1, 2, 3, category, size" />

will output all .webp images excluding these of category-name, portraits and ids 1,2,3, iirc.

Offline

#19 Today 11:36:24

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,427
Website

Re: Make the exclude attribute global

etc wrote #340124:

[…] you must combine two attributes: category="category-name" exclude="category".

Yes, that is what I have in my test page. For ID, I was playing with something that is part of a shortcode snippet, so reusable. without knowing ID’s in advance.

Exactly like categories, and you can mix multiple filters:

<txp:images category="category-name" extension="webp" size="portrait" exclude="1, 2, 3, category, size" />...

will output all .webp images excluding these of category-name, portraits and ids 1,2,3, iirc.

Ok, I see. I’ll play without those later. Thank you.


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

Offline

Board footer

Powered by FluxBB