Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Make the exclude attribute global
According to the documentation the exclude
by id attribute works for articles, but not in other lists such as the images
, linklist
, and file_download_list
. It would be cool if the attribute was global to allow a construction like this:
<txp:images category="my_category" limit="8" break="" exclude="377" />
A case where this will be of use is on an article where the image with id 377 which belongs to my_category
is the ‘hero’ on the top, and a gallery with the rest of the images further down the article.
In the real world the code could be
<txp:images category="my_category" limit="8" break="" exclude='<txp:custom_field name="article_image" />' />
or even
<txp:images category='<txp:custom_field name="image_category" />' limit="8" break="" exclude='<txp:custom_field name="article_image" />' />
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Make the exclude attribute global
+10
That would be quite useful.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: Make the exclude attribute global
I was just thinking that the exclude
attribute also works for section_list
and category_list
in a non numeric way. Would this complicate my feature request?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Make the exclude attribute global
To be pedantic, exclude
can not be global, i.e. applicable to all tags. Adding it to <txp:images />
etc is possible, though I would still prefer to unify different content types in a future txp version, to get it for free.
If only numeric id
s are concerned, might we use negative values instead:
<txp:images category="my_category" limit="8" break="" id="-377" />
Offline
Re: Make the exclude attribute global
etc wrote #340074:
To be pedantic,
exclude
can not be global, i.e. applicable to all tags. Adding it to<txp:images />
etc is possible, though I would still prefer to unify different content types in a future txp version, to get it for free.If only numeric
id
s are concerned, might we use negative values instead:
<txp:images category="my_category" limit="8" break="" id="-377" />...
wpould that also work with a comma separated list of ids?
<txp:images category="my_category" limit="8" break="" id="-377,-344" />...
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Make the exclude attribute global
colak wrote #340075:
wpould that also work with a comma separated list of ids?
<txp:images category="my_category" limit="8" break="" id="-377,-344" />...
It would, but this is not really handy, so let it be exclude
. But we need to decide, which attributes can be ‘excludable’: id
for sure, but what about extension
, size
and so on?
Offline
Re: Make the exclude attribute global
etc wrote #340077:
It would, but this is not really handy,…
Indeed!
… so let it be
exclude
. But we need to decide, which attributes can be ‘excludable’:id
for sure, but what aboutextension
,size
and so on?
I can actually think of cases where excluding extension
or size
would be helpful for some, but I’d also would like to hear what the community thinks.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Make the exclude attribute global
I certainly can see a use for ext
. size
I am not sure
In an ideal world the possibility to exclude based on a CF… Background: I use a jcr_image_custom
field to establish a link between the uploaded image an the same image in a different format (e.g. uploaded = jpg, altformat = webp). I might be interested in excluding images from a list when the CF is empty – exclude="<txp:jcr_image_custom name="foo" value="" />"
. I might be a little greedy with this :-)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: Make the exclude attribute global
Might (image) category be a candidate for exclusion ?
I can easily see a situation where you want to build an image gallery type object fetching images from various categories but one category should be omitted.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Offline
Re: Make the exclude attribute global
phiw13 wrote #340088:
Might (image) category be a candidate for exclusion ?
I can easily see a situation where you want to build an image gallery type object fetching images from various categories but one category should be omitted.
Unless I misunderstood your question, image categories can already be excluded. In docs.textpattern.com/tags/category_list:
<txp:category_list label="Image Categories" type="image" exclude="my-category" wraptag="ol" break="li" />
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Make the exclude attribute global
colak wrote #340091:
Unless I misunderstood your question, image categories can already be excluded.
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 />
.
There are various ways todo now what I suggested with category, one of which could be using categrory list in a variable.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline